Page 1 of 1
How to STOP Trimming
Posted: 2014-04-07T12:55:37-07:00
by dmfelder
I have a 4" x 4" canvas with a 3" x 3" image within it. In other words, there is a 1/2" transparent border around the entire layer. It is a PSD, and I am converting it to a smaller PNG.
I have tinkered with two different operations:
objMi.Convert "-resize", "400x400", myimagename1, tempimagename
objMi.Convert "-background", "none", "-layers", "merge", myimagename1, tempimagename
In each case, the operation is trimming the resulting image. I do not want to trim this image. It should maintain the proportional border. Am I doing something wrong?
Thanks for any help you guys can provide.
Re: How to STOP Trimming
Posted: 2014-04-07T13:21:58-07:00
by snibgo
Perhaps PS has created the image within a larger canvas, and "-layers flatten" will extend the image to the canvas.
Re: How to STOP Trimming
Posted: 2014-04-07T13:24:20-07:00
by dmfelder
In fact, just the basic
convert myPSDimage, myPNGimage
is trimming it.
Re: How to STOP Trimming
Posted: 2014-04-07T13:28:03-07:00
by fmw42
Can you post a link to your psd image? You can upload to dropbox.com (public folder) and put a link here. Then we can see what your input image is like and test with it.
Also what version of IM and what platform are you using?
Re: How to STOP Trimming
Posted: 2014-04-07T13:49:41-07:00
by dmfelder
I uploaded the PSD to: greatapparelforyou.com/tempimage.psd
It's difficult for me to know which version I'm working with because I'm using it in a unique way (VBA within Microsoft Access), and without a console. I have been using IM successfully within this realm for over a year, though. Ironically, historically, I've always wanted to trim.
Re: How to STOP Trimming
Posted: 2014-04-07T14:03:24-07:00
by glennrp
Your file actually contains two images, one fullsize and one trimmed.
Re: How to STOP Trimming
Posted: 2014-04-07T14:25:36-07:00
by dmfelder
I know you guys are very smart, so I will reluctantly accept what you say.
However, when I open it in Photoshop, it only has one layer.
Also, I was experimenting with the following code which would have merged them anyway: objMi.Convert "-background", "none", "-layers", "merge", myimagename1, tempimagename
Thoughts?
How can I reveal both layers?
Re: How to STOP Trimming
Posted: 2014-04-07T14:42:12-07:00
by snibgo
As glenrp says, IM can see two images. Take your pick which one you want.
Code: Select all
F:\web\im>%IM%convert tempimage.psd info:
tempimage.psd[0] PSD 1200x1200 1200x1200+0+0 8-bit CMYK 581KB 0.281u 0:00.062
tempimage.psd[1] PSD 1040x968 1040x968+80+116 8-bit CMYK 581KB 0.359u 0:00.078
F:\web\im>%IM%convert tempimage.psd[0] p0.png
F:\web\im>%IM%convert tempimage.psd[1] p1.png
Re: How to STOP Trimming
Posted: 2014-04-07T14:58:55-07:00
by dmfelder
That is truly remarkable. The image was created in Photoshop, too, as a single layer.
Thank you all for the input. I think using the [0] will work; although, I wonder if the [0] layer will always be the full size image in the event this happens again. Time will tell.
Cheers.
Re: How to STOP Trimming
Posted: 2014-04-07T15:09:46-07:00
by fmw42
When I download your image, it shows only one layer in IM 6.8.8.10 Q16 Mac OSX and Photoshop. Photoshop CS shows no oddities that I can see.
identify tempimage.psd
tempimage.psd PSD 1200x1200 1200x1200+0+0 8-bit CMYK 581KB 0.010u 0:00.000
Oddly, when I do the following, I get two identical png images (both the same size)
Code: Select all
convert tempimage.psd -trim +repage tmpimage.png
Likewise when converting your cmyk image to srgb.
Code: Select all
convert tempimage.psd -colorspace sRGB -trim +repage tmpimage2.png
And also when converting to RGB in Photoshop and saving, it still produces two png output images.
Saving the latter to tiff, produces an image with 2 layers as does saving to jpg.
But saving to PPM produces only one image.
Re: How to STOP Trimming
Posted: 2014-04-07T15:28:37-07:00
by dlemstra
It is correct that you are seeing two images. The first image is the 'merged' image that combines all the layers. The second image is the single layer that this image contains. And yes you should use tempimage.psd[0] to get the image with the transparent border.
Re: How to STOP Trimming
Posted: 2014-04-07T15:31:14-07:00
by fmw42
dlemstra wrote:It is correct that you are seeing two images. The first image is the 'merged' image that combines all the layers. The second image is the single layer that this image contains.
You are probably right about that. I forgot that IM would create the flattened layer whether there was one layer or not.
But then it is strange that when converting to PPM, I do not get two output images.
Re: How to STOP Trimming
Posted: 2014-04-07T15:38:53-07:00
by snibgo
On 6.8.8-7 on Windows 8.1, I do get two images in the PPM file.
Code: Select all
convert tempimage.psd -compress none p.ppm
Looking at p.ppm, I can see where the second image starts at "P3".
Re: How to STOP Trimming
Posted: 2014-04-07T15:41:23-07:00
by dlemstra
PPM supports multiple images in one file:
Code: Select all
D:\Test\psd>identify tempimage.ppm
tempimage.ppm[0] PPM 1200x1200 1200x1200+0+0 8-bit sRGB 7.34MB 0.031u 0:00.029
tempimage.ppm[1] PPM 1040x968 1040x968+0+0 8-bit sRGB 7.34MB 0.016u 0:00.018
Re: How to STOP Trimming
Posted: 2014-04-07T17:28:19-07:00
by fmw42
PPM supports multiple images in one file:
Thanks. I forgot about that.