Page 1 of 1
Converting PSD files with undeleted cropped pixels
Posted: 2016-05-17T21:40:14-07:00
by secondplace
hi,
i'm trying to batch convert several PSD files. apparently the have been cropped inside photoshop without the 'delete cropped pixels' function.
When i run something along the lines of this:
Code: Select all
convert.exe *.psd -resize 1000x1000 *.jpg
the output will look the following:
how to tell imagemagick to ignore the undeleted cropped pixels?
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-17T22:26:22-07:00
by snibgo
I suppose Photoshop doesn't change the image, but merely writes some metadata about the crop. I don't know if IM can read that metadata. If you put up a sample cropped PSD, someone might take a look.
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-17T22:43:49-07:00
by secondplace
here is a sample (270kb) saved from cs6:
edit: sample removed, i uploaded a new version in the post bellow.
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-17T23:23:03-07:00
by snibgo
Exiftool says "Has crop: false".
IM's identify says there are two identical images, both 357x259. They look like the image on the left in the OP.
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-18T03:49:46-07:00
by secondplace
first of all, i messed up the sample. sry for that *selfslap*
i've done some more testing and i get different results depending on how i process the images.
if i process a single image that is (240dpi) i get two output files, name-0.jpg and name-1.jpg.'-0' being correct cropped and '-1' is with the hidden area.
if i convert the image to 72dpi first in photoshop i still get two output files but both are cropped correct.
now with batch convert i get only one output which is the wrong cropped one. i assume the second written image overwrites the first one which would have been correct.
here is my batch script:
Code: Select all
convert.exe *.psd -resize 1000x1000 -quality 80% -density 72x72 -set filename:f %t_tmb %[filename:f].jpg
here the for the single image:
Code: Select all
convert.exe name.psd -resize 1000x1000 -quality 80% -density 72x72 name.jpg
it also seems that on smaller images the it saves out both images with the correct crop so i guess it also has to do with the image size. so here a full test image (80mb): *edit* removed, solution found below!
is it possible to tell imagemagick to write only the correct cropped one which would be the first of the two?
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-18T10:09:52-07:00
by snibgo
Append [n] to the input file, where n is the number of the required image in the file, starting from zero. Eg:
Code: Select all
convert.exe name.psd[0] -resize 1000x1000 -quality 80% -density 72x72 name.jpg
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-18T21:57:38-07:00
by secondplace
thank you very much for the solution snibgo
(some other thing i just noticed. it works fine with jpg. when i try to batch output tiff files it only writes the first image it finds in a folder.)
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-18T23:09:07-07:00
by fmw42
What is your exact command line for the above problem with tif. JPD does not allow multilayers, but TIF and PSD do. The first layer of the PSD is the flattened layer, but each layer of TIF is a different layer. Can you post an example tif where this fails? What is that you want for the output from TIF files?
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-19T00:56:25-07:00
by secondplace
the command line is about the same as the one i posted except with tif as output:
Code: Select all
convert.exe *.psd[0] -resize 1000x1000 -density 72x72 -set filename:f %t_tmb %[filename:f].tif
i cannot upload multiple 100mb+ psd files from here since i'm currently on prepay in a third world country.
but download my previous sample here and try to multiply it, that should give you the same result:
http://3dart.tv/beta/imagemagick_convertsample_v2.rar (83mb)
hope that helps
Re: Converting PSD files with undeleted cropped pixels
Posted: 2016-05-19T01:25:57-07:00
by snibgo
These are large images. A "convert *.psd" will attempt to read all the images into memory at the same time.
A better strategy is either to use "mogrify", or to put the convert inside a for-loop, so each convert reads only one file.