Color changes when converting PDF to JPG using PHP
-
- Posts: 5
- Joined: 2015-07-22T15:44:39-07:00
- Authentication code: 1151
Color changes when converting PDF to JPG using PHP
When I am converting PDF to JPG using PHP and Command, the color is changing.
Following command are using
convert -limit memory 0 -limit map 0 -quiet -define pdf:use-cropbox=true -interlace none -density 300x300 +repage "source" "destination"
Original PDF http://basiljohn.com/test/0315+EA+Autumn+4.pdf
Image http://basiljohn.com/test/7664-max.jpg
Image http://basiljohn.com/test/7666-max.jpg
Any help please?
Following command are using
convert -limit memory 0 -limit map 0 -quiet -define pdf:use-cropbox=true -interlace none -density 300x300 +repage "source" "destination"
Original PDF http://basiljohn.com/test/0315+EA+Autumn+4.pdf
Image http://basiljohn.com/test/7664-max.jpg
Image http://basiljohn.com/test/7666-max.jpg
Any help please?
-
- Posts: 5
- Joined: 2015-07-22T15:44:39-07:00
- Authentication code: 1151
Re: Color changes when converting PDF to JPG using PHP
ImageMagick version using v6.8.4-10
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color changes when converting PDF to JPG using PHP
There were changes to IM around 6.8.x that may be affecting your processing. You might upgrade to the current version.
My system will not let me go to the place you have uploaded your images, saying "High Risk Website Blocked". Perhaps you should upload your images to dropbox.com.
My system will not let me go to the place you have uploaded your images, saying "High Risk Website Blocked". Perhaps you should upload your images to dropbox.com.
-
- Posts: 5
- Joined: 2015-07-22T15:44:39-07:00
- Authentication code: 1151
Re: Color changes when converting PDF to JPG using PHP
Thank you for the quick reply
following are the link
PDF : https://www.dropbox.com/s/h3gfun37rgm1b ... 4.pdf?dl=0
Image : https://www.dropbox.com/s/judrpulzsu3rv ... x.jpg?dl=0
https://www.dropbox.com/s/s5jniqnjndvyk ... x.jpg?dl=0
following are the link
PDF : https://www.dropbox.com/s/h3gfun37rgm1b ... 4.pdf?dl=0
Image : https://www.dropbox.com/s/judrpulzsu3rv ... x.jpg?dl=0
https://www.dropbox.com/s/s5jniqnjndvyk ... x.jpg?dl=0
Re: Color changes when converting PDF to JPG using PHP
Your input pdf is CMYK. Output is RGB.
Current release of ImageMagick (6.9.1-9) does not change colorspace with your command, i.e. CMYK jpg is generated. So if you want CMYK jpg, upgrade is recommended.
Current release of ImageMagick (6.9.1-9) does not change colorspace with your command, i.e. CMYK jpg is generated. So if you want CMYK jpg, upgrade is recommended.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color changes when converting PDF to JPG using PHP
Your input PDF is CMYK, you probably need to convert it to sRGB with profiles when saving to JPG.
Try this (unix syntax) for the first page. It works for me on IM 6.9.1.9 Q16 Mac OSX
use your own path to these profiles.
Please always identify your version of IM and platform. Your version of IM may be too old or buggy to do the convert to CMYK JPG. So you may need an upgrade.
On my Mac OSX with IM 6.9.1.9, a direct conversion looks color inverted when displayed as per the following command line. This is often an issue with CMYK JPG
So I would stick with the profile conversion to sRGB as the safest measure. Some viewers do not handle CMYK JPEG very well.
Try this (unix syntax) for the first page. It works for me on IM 6.9.1.9 Q16 Mac OSX
Code: Select all
convert 0315+EA+Autumn+4.pdf[0] \
-profile /Users/fred/images/profiles/USWebCoatedSWOP.icc \
-profile /Users/fred/images/profiles/sRGB.icc \
test_srgb.jpg
Please always identify your version of IM and platform. Your version of IM may be too old or buggy to do the convert to CMYK JPG. So you may need an upgrade.
On my Mac OSX with IM 6.9.1.9, a direct conversion looks color inverted when displayed as per the following command line. This is often an issue with CMYK JPG
Code: Select all
convert 0315+EA+Autumn+4.pdf[0] 0315+EA+Autumn+4_0.jpg
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color changes when converting PDF to JPG using PHP
This may also work, but the profile method gives more accurate colors.
Code: Select all
convert -colorspace sRGB 0315+EA+Autumn+4.pdf[0] test_srgb2.jpg
-
- Posts: 5
- Joined: 2015-07-22T15:44:39-07:00
- Authentication code: 1151
Re: Color changes when converting PDF to JPG using PHP
Thank you so much, its much better now. I have used following command.
convert -limit memory 0 -limit map 0 -quiet -define pdf:use-cropbox=true -interlace none -background white -alpha remove -density 300x300 +repage -colorspace sRGB " SOURCE -quality 95 jpg:" DESTINATION;
can you please tell me from where i can download, sRGB.icc
Thank You
convert -limit memory 0 -limit map 0 -quiet -define pdf:use-cropbox=true -interlace none -background white -alpha remove -density 300x300 +repage -colorspace sRGB " SOURCE -quality 95 jpg:" DESTINATION;
can you please tell me from where i can download, sRGB.icc
Thank You
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Color changes when converting PDF to JPG using PHP
Look in the directory that contains your convert program.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color changes when converting PDF to JPG using PHP
I do not think they are there by default. I think they must be installed. At least that is how it is on my Mac. Neither the IM download folder nor my folder that contains the installed convert program have profiles located there.snibgo wrote:Look in the directory that contains your convert program.
I installed them from:
Get them from profiles.zip at http://www.imagemagick.org/download/delegates/
or
http://www.mattbeals.com/icc/
or for just sRGB.icc, you can get it at http://www.color.org/srgbprofiles.xalter
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Color changes when converting PDF to JPG using PHP
Thanks for the correction. sRGB.icc is provided with the IM installation on Windows, but may not be with other installations.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Color changes when converting PDF to JPG using PHP
Perhaps that is the case with all binaries, but not when installing from source?snibgo wrote:Thanks for the correction. sRGB.icc is provided with the IM installation on Windows, but may not be with other installations.
-
- Posts: 5
- Joined: 2015-07-22T15:44:39-07:00
- Authentication code: 1151
Re: Color changes when converting PDF to JPG using PHP
Thank you so much guys for all the help. I didn't try with profiles yet. I will let you know once after I have used that.