FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP image grenation





flatliner
Hi there

I am working on a project were I have an existting image of 300dpi and I want to write text to the image. The image most then be outputted to the browser including the text at 300dpi and then I wish to save the image to a file. I.E that the text is now one with the image and is printable. Thats why it has to be 300dpi.

Which functions from the GB/ImageMagick etc do I need to make the text and image one and what function allows the image to be outputted at 300dpi

Thanks Very Happy
rvec
read this: http://nl3.php.net/gd
all your answers are there.
flatliner
rvec wrote:
read this: http://nl3.php.net/gd
all your answers are there.


Already been there and googled the subject for hours and cant really find what I am looking for with the DPI problem. writing text to the image I have solved, but I cant find anything on increase the DPI from the default of 75 (web graphics) to 300 (printing quality)
rvec
Quote:
well. i speak about jpeg files only.
a jpeg file has structure as following (ie) :

2 first bytes : FF D8 => SOI 'Start Of Image' marker
then (2 bytes) : FF E0 => App0 marker
then (2 bytes) : 00 10 => marker length (the next 14 + these , so 16)
then (5 bytes) : 4A 46 49 46 00 => identifier (JFIF0)
then (2 bytes) : 01 01 => version (1.01)
then (1 byte) : 01 => units for the X and Y densities (00 : no units,
X and Y specify the pixel aspect ratio ;
01 : X and Y are dots per inch ;
02 : X and Y are dots per cm)
then (2 bytes) : 01 2C => horizontal pixel density (01 2C = 300dpi ;
00 01 = 72dpi)
then (2 bytes) : 01 2C => vertical pixel density (01 2C = 300dpi ;
00 01 = 72dpi)
then (1 byte) : 00 => thumbnail horizontal pixel count X
then (1 byte) : 00 => thumbnail vertical pixel count Y
others : ......
since (2 bytes): FF DB => DTQ marker
end others : ......
00 43 00 01 01 01 01 01 01 01 01 01 ...etc


source: http://bytes.com/forum/thread5948.html

so this should be possible with fopen and you should also be able to change it that way. Not sure what would happen but you could try that out before importing the image.
flatliner
rvec wrote:
Quote:
well. i speak about jpeg files only.
a jpeg file has structure as following (ie) :

2 first bytes : FF D8 => SOI 'Start Of Image' marker
then (2 bytes) : FF E0 => App0 marker
then (2 bytes) : 00 10 => marker length (the next 14 + these , so 16)
then (5 bytes) : 4A 46 49 46 00 => identifier (JFIF0)
then (2 bytes) : 01 01 => version (1.01)
then (1 byte) : 01 => units for the X and Y densities (00 : no units,
X and Y specify the pixel aspect ratio ;
01 : X and Y are dots per inch ;
02 : X and Y are dots per cm)
then (2 bytes) : 01 2C => horizontal pixel density (01 2C = 300dpi ;
00 01 = 72dpi)
then (2 bytes) : 01 2C => vertical pixel density (01 2C = 300dpi ;
00 01 = 72dpi)
then (1 byte) : 00 => thumbnail horizontal pixel count X
then (1 byte) : 00 => thumbnail vertical pixel count Y
others : ......
since (2 bytes): FF DB => DTQ marker
end others : ......
00 43 00 01 01 01 01 01 01 01 01 01 ...etc


source: http://bytes.com/forum/thread5948.html

so this should be possible with fopen and you should also be able to change it that way. Not sure what would happen but you could try that out before importing the image.

Maybe I am not seeing it or somthing, but I can seem to make it out from that link.

I am looking to output an image which has had text added to it via the PHP GB lib and the orginal image was 300dpi and 1.6mb file size but when the image is outputed with the text in it, its 75dpi and the file size is like 300kB.

How can I keep the orginal dpi of 300.???
flatliner
Got it Very Happy

I figured it out myself, if the image is outputted to the browser its auto output at 75dpi, but if you save it to the server like below you can get the full 300dpi.

Code:


// Comment
//
// imagejpeg(your_image_source,image_name,image_quality)
//                                                                                       

imagejpeg($image,my_image,100);


chatrack
Thank you,
I also have the web image getting 72dpi always.. thanks for the solution
Related topics
E-Cards with PHP & MySQL
PHP Image Upload (MySQL/Folder)
PHP Image suddenly doesn't work?
php image exif functions
mysql/php help please
PHP image
PHP image uploads with progress bar AND resizing? [Resolved]
let me tell you... this is not an image! it's HTML code!
Transparent background image
PHP Image Questions
PHP Image functions
Opening any image with PHP. Couldn't find anywhere.
xMPACT! PHP Image Viewer 1.0
PhP Image gallery?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.