Remove or avoid offset after some conversions
Posted: 2015-06-29T12:09:42-07:00
I'm doing some processing for an image and it's entirely necessary that I preserve the original center of the image.
I start with a 580x480 source image. There are 100 pixels on the right that I need to get rid of, and also, I only need a 478x478 circle of the image. So, I created a 480x480 mask file that has a 478x478 circle. I crop off the 100 pixels that I don't want, and I composite it with the mask to only have the 478x478 pixels of the circle that I need for production.
My issue is that I'm getting a 1,1 offset. I can tell that the center is off, because there's a cross in the center of the image. When I overlay a "test" layer that should give me the true center, the crosses don't quite line up. I know that the test layer is correct.
These are my commands
Masking and removing the rightmost 100 pixels with the composite and trim.
Note that this takes a 580x480 pixel image and masks it with a 480x480 image and makes it a 478x478 circular image
Removing the colours that I don't want from the image
478x478 is still 478x478
Overlaying the test layer
478x478 is still 478x478
So my guess is that something goes wrong in the first part of the code, but I don't know how to resolve it. When I try to open any of the images in GIMP, I am notified that there is an offset of 1,1.
Any suggestions for different or additional commands to resolve this?
Thanks!
I start with a 580x480 source image. There are 100 pixels on the right that I need to get rid of, and also, I only need a 478x478 circle of the image. So, I created a 480x480 mask file that has a 478x478 circle. I crop off the 100 pixels that I don't want, and I composite it with the mask to only have the 478x478 pixels of the circle that I need for production.
My issue is that I'm getting a 1,1 offset. I can tell that the center is off, because there's a cross in the center of the image. When I overlay a "test" layer that should give me the true center, the crosses don't quite line up. I know that the test layer is correct.
These are my commands
Masking and removing the rightmost 100 pixels with the composite and trim.
Note that this takes a 580x480 pixel image and masks it with a 480x480 image and makes it a 478x478 circular image
Code: Select all
convert source.png mask.png
-alpha Off
-compose CopyOpacity
-composite
-trim
+repage
output1.png
478x478 is still 478x478
Code: Select all
-convert output1.png
-channel rgba
-alpha set
-fill none
-opaque "#999960"
-opaque "#333360"
-opaque "#000000"
output2.png
478x478 is still 478x478
Code: Select all
-convert output2.png test.png
-composite
final.png
Any suggestions for different or additional commands to resolve this?
Thanks!