Page 2 of 2

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-15T07:30:09-07:00
by magick
Crosses.pdf includes a profile that is incompatible with the PDF output type. The input is sRGB and the output is gray alpha. You have two choices, strip the profile or force sRGB output with +profile sRGB or -type sRGB. Place either just before the output image filename on the command-line. Why does ImageMagick not do that automatically? Because the "user is king." ImageMagick assumes the user knows what they are doing and just follows the user instructions as defined by the command-line arguments.

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-15T21:27:21-07:00
by jauson
Like this?

Code: Select all

convert -verbose -density 288 -colorspace sRGB crosses.pdf  -alpha remove +profile sRGB out-2-x.pdf
convert -verbose -density 288 -colorspace sRGB out-2-x.pdf  -alpha remove +profile sRGB out-2-x-2nd-save.pdf

It's still producing the same results.

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-19T10:12:48-07:00
by jauson
magick wrote: 2018-09-15T07:30:09-07:00 Crosses.pdf includes a profile that is incompatible with the PDF output type. The input is sRGB and the output is gray alpha. You have two choices, strip the profile or force sRGB output with +profile sRGB or -type sRGB. Place either just before the output image filename on the command-line. Why does ImageMagick not do that automatically? Because the "user is king." ImageMagick assumes the user knows what they are doing and just follows the user instructions as defined by the command-line arguments.
I tried both, but neither works.

Code: Select all

convert -verbose -density 288 -colorspace sRGB crosses.pdf  -alpha remove  -type sRGB out-2-x.pdf
convert -verbose -density 288 -colorspace sRGB out-2-x.pdf  -alpha remove  -type sRGB out-2-x-2nd-save.pdf
Throws an error:

Code: Select all

convert.exe: unrecognized image type `sRGB' @ error/convert.c/ConvertImageCommand/3085.

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-19T20:08:08-07:00
by fmw42
Please, always provide your IM version and platform when asking questions, since syntax may differ. Also provide your exact command line and if possible your images.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-19T21:57:45-07:00
by jauson
GS 9.24 and Version: ImageMagick 6.9.10-11 Q16 x64 2018-08-29 Windows 8.1

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-20T09:44:51-07:00
by fmw42
This fails for me on IM 6.9.10.11 Q16 Mac OSX Sierra. The png files are wrong.

Code: Select all

convert crosses.pdf tmp.pdf
convert tmp.pdf tmp.png

But adding -strip works fine for me

Code: Select all

convert crosses.pdf -strip tmp.pdf
convert tmp.pdf tmp.png

This also works by adding +profile "*"

Code: Select all

convert crosses.pdf +profile "*" tmp.pdf
convert tmp.pdf tmp.png

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-20T18:53:32-07:00
by jauson
That does produce the expected result. I noticed the 2nd save gets a little lighter, bigger in size.

Code: Select all

# increase in size
convert -verbose -density 288 -colorspace sRGB crosses.pdf  -alpha remove +profile '*' out-2-x.pdf
# lighter increase in size
convert -verbose -density 288 -colorspace sRGB out-2-x.pdf  -alpha remove +profile '*' out-2-x-2nd-save.pdf
# same as above
convert -verbose -density 288 -colorspace sRGB out-2-x-2nd-save.pdf  -alpha remove +profile '*' out-2-x-3nd-save.pdf

Also, it seems I can't undo the damage of outputting a previously saved pdf without this profile or strip command.

Code: Select all

convert -verbose -density 288  -colorspace sRGB crosses.pdf  -alpha remove out-2-x.pdf
convert -verbose -density 288  -colorspace sRGB out-2-x.pdf  -alpha remove +profile '*' out-2-x-2nd-save.pdf
convert -verbose -density 288  -colorspace sRGB out-2-x.pdf  -alpha remove -strip out-2-x-3rd-save.pdf

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-20T19:57:44-07:00
by fmw42
The -strip removes more meta data than the +profile. So it could produce differences.

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-22T23:18:00-07:00
by jauson
Neither +profile nor -strip can fix the output that doesn't use either.

Re: How to rotate pdf and undo rotating? Gives unexpected results.

Posted: 2018-09-24T22:58:28-07:00
by jauson
thanks fmw42 for your help.