473,382 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

GD default DPI

MC
Hi,

I'm currently making a website that needs to edit images with adding text,
the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
edits the image, it's set to 72 which i read to be the default value GD
always uses. is there a way to edit that default to a higher number, if not
are there other ways to edit images through php and still keeping the
original DPI.
Jul 17 '05 #1
4 6963
"MC" <madcow@false> wrote:
I'm currently making a website that needs to edit images with adding text,
the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
edits the image, it's set to 72 which i read to be the default value GD
always uses. is there a way to edit that default to a higher number, if not
are there other ways to edit images through php and still keeping the
original DPI.


hi mc* !

here is an answer which I made here in May 2004

<cite>
first : sorry for my (very) bad english, but I'm french (and nobody's
perfect...)**

about picture :
picture is defined by X pixels x Y pixels (ie : 1200px x 856px).
on web (screen) this picture will fill a surface of 1200 pixels by 856
pixels.
but for printing it (on paper) you must calculate :
if you print at 300dpi (good offset), dimensions of your picture on
paper will be 1200/300 by 856/300 thus 4 inches by 2.8 inches ;
if you print at 135dpi (offset), dimensions of your picture on paper
will be 1200/3135 by 856/135 thus 8.9 inches by 6.3 inches.

and if you want a 12 inches by 8.6 inches picture on paper its
resolution will be 100dpi.

thus, you can know the quality of your final print just by knowing the
dimensions (in pixels) of your picture.

about gd :
when I create a jpeg image with gd, I always have a 72dpi image.
I use the php getimagesize function and I calculate :
round((getimagesize($my_picture)[0] * 0.85) / 100)
for width (cm) at 300dpi ;
round((getimagesize($my_picture)[1] * 0.85) / 100)
for height (cm) at 300dpi.

'et voila !'
</cite>
* here, in france, we have just had the first 'mad **goat**' !
what is a little worrying...
** this did not change !

--
@@@@@
E -00 yes ! france... near japan !
' `) /
|\_ =="
Jul 17 '05 #2
MC
Well, so u're saying i need to enlarge the image to later on resample it to
a smaller size so the DPI value is higher?
But i start with "uploaded" images, so if if i enlarge that image to later
resample won't the DPI value be lower again and/or won't the image have less
good pixelations?
"denisb" <ne***@no-log.org> schreef in bericht
news:1grasr8.1bpesjdfkvo00N%ne***@no-log.org...
"MC" <madcow@false> wrote:
I'm currently making a website that needs to edit images with adding
text,
the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
edits the image, it's set to 72 which i read to be the default value GD
always uses. is there a way to edit that default to a higher number, if
not
are there other ways to edit images through php and still keeping the
original DPI.


hi mc* !

here is an answer which I made here in May 2004

<cite>
first : sorry for my (very) bad english, but I'm french (and nobody's
perfect...)**

about picture :
picture is defined by X pixels x Y pixels (ie : 1200px x 856px).
on web (screen) this picture will fill a surface of 1200 pixels by 856
pixels.
but for printing it (on paper) you must calculate :
if you print at 300dpi (good offset), dimensions of your picture on
paper will be 1200/300 by 856/300 thus 4 inches by 2.8 inches ;
if you print at 135dpi (offset), dimensions of your picture on paper
will be 1200/3135 by 856/135 thus 8.9 inches by 6.3 inches.

and if you want a 12 inches by 8.6 inches picture on paper its
resolution will be 100dpi.

thus, you can know the quality of your final print just by knowing the
dimensions (in pixels) of your picture.

about gd :
when I create a jpeg image with gd, I always have a 72dpi image.
I use the php getimagesize function and I calculate :
round((getimagesize($my_picture)[0] * 0.85) / 100)
for width (cm) at 300dpi ;
round((getimagesize($my_picture)[1] * 0.85) / 100)
for height (cm) at 300dpi.

'et voila !'
</cite>
* here, in france, we have just had the first 'mad **goat**' !
what is a little worrying...
** this did not change !

--
@@@@@
E -00 yes ! france... near japan !
' `) /
|\_ =="

Jul 17 '05 #3
"MC" <madcow@false> wrote:
Well, so u're saying i need to enlarge the image to later on resample it to
a smaller size so the DPI value is higher?
But i start with "uploaded" images, so if if i enlarge that image to later
resample won't the DPI value be lower again and/or won't the image have less
good pixelations?


no no no.

the image uploaded has its own dimensions : xxx pixels by xxx pixels.
that's all.

I understand that you use gd to add text to this image.

if the image is large enough to be printed correctly, just add your text
on it (do it by envisaging for the text an adapted size) then
dimensions of the new image, created by gd, will not have changed.

but, the best you can do is to test yourself :

upload an image 250 px by 400 px (300dpi or 72dpi, we don't care) ;
do your job ;
download the new image ;
see what happens

--
@@@@@
E -00 comme on est very beaux dis !
' `) /
|\_ =="
Jul 17 '05 #4
MC wrote:
Hi,

I'm currently making a website that needs to edit images with adding text,
the problem is, the picture starts at 300 DPI (pixels/inch), but after GD
edits the image, it's set to 72 which i read to be the default value GD
always uses. is there a way to edit that default to a higher number, if not
are there other ways to edit images through php and still keeping the
original DPI.


What about ImageMagick? There's a PHP module for it, called 'php_magick'.
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: earl | last post by:
class temp { public: temp(); foo(char, char, char*); private: char matrix; }; temp::foo(char p, char o, char m = matrix )
0
by: inquirydog | last post by:
Hi- I am using xml to hold configuration data for a project, and using schema to define what the configuration file should look like. I wanted to get some advice on an intelligant way to...
15
by: A | last post by:
Hi, A default copy constructor is created for you when you don't specify one yourself. In such case, the default copy constructor will simply do a bitwise copy for primitives (including...
4
by: Steven T. Hatton | last post by:
I mistakenly set this to the comp.std.c++ a few days back. I don't believe it passed the moderator's veto - and I did not expect or desire anything different. But the question remains: ISO/IEC...
10
by: Ook | last post by:
I'm having trouble comprehending what exactly "default construction" is. I know how to provide a constructor with initial values, so that if I, for example, in my code do this: MyClass...
19
by: Andrew J. Marshall | last post by:
I want to create a class that must receive a parameter when instantiated. In other words, I do not want it to have a "Public Sub New()". 1) Does VB.NET create a default public constructor if I do...
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
4
by: Jess | last post by:
Hello, I tried several books to find out the details of object initialization. Unfortunately, I'm still confused by two specific concepts, namely default-initialization and...
4
by: Macneed | last post by:
i am a newbie, i remember i read a book talking about when u declare a array variable using float ABC = new float; the whole array element in ABC ( ABC to ABC ) will automatic initialize to 0...
7
by: =?Utf-8?B?Y291Z2FyaXN0aWM=?= | last post by:
I am trying to convert an C# application to VB and have one issue which is converting the generic value to the default. C# uses return default(T) as the return value how would I translate this in...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.