Thumbnail help needed

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
mcs

Thumbnail help needed

Post by mcs »

Sorry if this is a duplicate post. I am unsure where to place as I ave gotten views but no responses. Any one have any ideas?

I am using IM 6.4.0-2-Q16 to convert and bild jpgs for Illustrator and Photoshop files uploaded to a directory on my server. On alot of photoshop files I get a bizarre preview image. The image has white squares or sometimes garbled lines in place of where the image goes. The files are quite often very large that it is building the image from. Others i build just fine. I suspect it has something to do with transparency or effects applied to layers. I am flattening the image and converting to rgb to try and resolve the issue

This is an example image

Image

This is the high res file 89 megs

http://tinyurl.com/6cyzp2

This is the code I have tried (2 versions) same results with both
Latest:
Convert """&Whichfolder&"\"&filename&""" -strip -profile USWebCoatedSWOP.icc -profile sRGB.icc -flatten -thumbnail 250 """&FilePath&"\thumbnails\"&newname&

Previous:
Convert """&Whichfolder&"\"&filename&""" -colorspace rgb -flatten -thumbnail 250 """&FilePath&"\thumbnails\"&newname&

A appreciate anyones feedback as this has plagued me since Photoshop CS 2.0

Thanks
nsh
Posts: 27
Joined: 2006-05-16T01:52:23-07:00

Re: Thumbnail help needed

Post by nsh »

Seams that the original image is a multi layer image.

try : convert orgimage[0] test.jpg
mcs

Re: Thumbnail help needed

Post by mcs »

I couldnt understand the command you sent me and how to enter it but I tried a few options and it created me 5 thumbnails one for each layer. What I want it to flatten it (all layers into 1) and create a thumbnail. They all result in the same issue each looking slightly different. Even when I did the one thumbnail for each layer, all of them had errors. I appreciate your suggestions...let me know if you have any other ideas.

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Thumbnail help needed

Post by fmw42 »

can you provide a smaller image for us to test - 89M is rather big.

to flatten and make a thumbnail, you can try:

convert inputimage -flatten -thumbnail 100 outputimage
or
convert inputimage -flatten -thumbnail 100x100 outputimage

These should make an image that is 100 on the largest side and smaller than 100 on the smaller side

or

convert inputimage -flatten -thumbnail 100^ outputimage

this should make an image that is 100 on the smaller side and larger than 100 on the larger side
mcs

Re: Thumbnail help needed

Post by mcs »

ok I used a different file with a lower res and got the same typical results:

Heres the original 4 Megs:
http://tiny.cc/Fks2t

Heres the command I used last:
convert image.psd -flatten -thumbnail 100 image.jpg
I have also tried adding profile rgb and resize instead of thumbnail

Heres the result:
Image
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Thumbnail help needed

Post by magick »

This works for us:
  • convert dsh_1186_plane\ krazy\ art.psd'[0]' -thumbnail 100 image.jpg
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Thumbnail help needed

Post by fmw42 »

You have a multi-frame image with 9 frames and each is a different size and contains other data.

identify dsh_1186_plane_krazy_art.psd
dsh_1186_plane_krazy_art.psd[0] PSD 600x655 600x655+0+0 DirectClass 8-bit 4.13393mb 11.400u 0:12
dsh_1186_plane_krazy_art.psd[1] PSD 600x655 600x655+0+0 DirectClass 8-bit 4.13393mb 11.320u 0:12
dsh_1186_plane_krazy_art.psd[2] PSD 389x55 389x55+114+573 DirectClass 8-bit 4.13393mb 11.290u 0:12
dsh_1186_plane_krazy_art.psd[3] PSD 385x52 385x52+116+574 DirectClass 8-bit 4.13393mb 11.290u 0:12
dsh_1186_plane_krazy_art.psd[4] PSD 475x565 475x565+46+34 DirectClass 8-bit 4.13393mb 11.290u 0:12
dsh_1186_plane_krazy_art.psd[5] PSD 474x565 474x565+46+34 DirectClass 8-bit 4.13393mb 11.270u 0:12
dsh_1186_plane_krazy_art.psd[6] PSD 438x396 438x396+72+138 DirectClass 8-bit 4.13393mb 11.250u 0:12
dsh_1186_plane_krazy_art.psd[7] PSD 438x396 438x396+72+138 DirectClass 8-bit 4.13393mb 11.230u 0:12
dsh_1186_plane_krazy_art.psd[8] PSD 472x521 472x521+47+75 DirectClass 8-bit 4.13393mb 11.220u 0:12

I simply took the first frame and converted it to jpg and that looks like a meaningful result. I do not know what the other frames are!

convert dsh_1186_plane_krazy_art.psd[0] dsh_1186_plane_krazy_art.jpg

If this result is not what you are expecting, then I suspect you need to flatten the image in Photoshop first before exporting it to IM. IM (6.4.0.4) does not seem to be able to combine the frames in the way you expect. Or I do not know how to do that.

You can look at each by separating the frames:

convert dsh_1186_plane_krazy_art.psd dsh_%d.jpg

then

display dsh_0.jpg
display dsh_1.jpg
...
display dsh_8.jpg
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Thumbnail help needed

Post by magick »

PSD images generally contain both a flattened version of the image and all its layers. Use the '[0]' form of the filename to just select the pre-flattened version of the image.
mcs

RESOLVED: Thumbnail help needed

Post by mcs »

Wow that was the closest I have ever come and very acceptable. I thought Imagemagick treated layers the same as Photoshop but [0] must be a preview layer and not the 1st layer. I added -flatten to the command above and it is perfect! Thanks...final command:

convert image.psd[0] -flatten -thumbnail 250 image.jpg

You guys solved my year old headache.
Last edited by mcs on 2008-04-15T14:02:17-07:00, edited 1 time in total.
mcs

Re: Thumbnail help needed

Post by mcs »

one more question...if the file is an AI instead of a psd file do you think having [0] is ok or will I have to treat each differently? for example convert image.AI[0]
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Thumbnail help needed

Post by fmw42 »

sorry, I don't know anything about AI files. You could post an example.


Also, just a comment, but if the first frame is already a flattened version, then you should not need to add -flatten to your IM command line. Does it really make a difference in the final image?
Post Reply