How to STOP Trimming
How to STOP Trimming
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.
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.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to STOP Trimming
Perhaps PS has created the image within a larger canvas, and "-layers flatten" will extend the image to the canvas.
snibgo's IM pages: im.snibgo.com
Re: How to STOP Trimming
In fact, just the basic
convert myPSDimage, myPNGimage
is trimming it.
convert myPSDimage, myPNGimage
is trimming it.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to STOP Trimming
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?
Also what version of IM and what platform are you using?
Re: How to STOP Trimming
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.
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
Your file actually contains two images, one fullsize and one trimmed.
Re: How to STOP Trimming
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?

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?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to STOP Trimming
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
snibgo's IM pages: im.snibgo.com
Re: How to STOP Trimming
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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to STOP Trimming
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)
Likewise when converting your cmyk image to srgb.
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.
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
Code: Select all
convert tempimage.psd -colorspace sRGB -trim +repage tmpimage2.png
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
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.
Last edited by dlemstra on 2014-04-07T15:35:08-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to STOP Trimming
You are probably right about that. I forgot that IM would create the flattened layer whether there was one layer or not.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.
But then it is strange that when converting to PPM, I do not get two output images.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to STOP Trimming
On 6.8.8-7 on Windows 8.1, I do get two images in the PPM file.
Looking at p.ppm, I can see where the second image starts at "P3".
Code: Select all
convert tempimage.psd -compress none p.ppm
snibgo's IM pages: im.snibgo.com
Re: How to STOP Trimming
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
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to STOP Trimming
Thanks. I forgot about that.PPM supports multiple images in one file: