linux - How to offset image contents by X,Y pixels using ImageMagick? -
i need offset pixels in png image -1 in x , -4 in y axis.
the images converted pdf created corel draw, adds offset, breaking image processing system i'm working on. align_image_stack hugin-tools package crashes when processing these files, that's why resort trying fixed offest correction.
i tried these commands:
$ convert a.png: -geometry 100%-100-100 b.png $ convert -region '100%+500px+100px' a.png b.png $ convert -page '100%+500px+100px' a.png b.png $ convert -repage '100%+500px+100px' a.png b.png $ convert -crop '100%+500px+100px' a.png b.png $ convert a.png -geometry 100%-100px-100px b.png
they have finished without error, gave me same image fed them input.
a.png = b.png
what doing wrong? why covert command not shift image contents?
edit:
here's pair of images illustrate problem. first image want, second comes out of corel draw, want apply arbitrary x/y offset compensate difference. images faked illustrate problem, not authentic data.
new point able produce offset once, can't reproduce this. looks me bug in imagemagick, because i'm trying same command used before , doesn't work now.
i tried using graphicsmagick doublechek this.
i able offset written png header, doesn't make blender use offset, need "burn" offset bitmap data, not specify in metadata.
this command did change, gimp seems understands , need make blender apply offset:
convert a.png -repage '100%x100%+100+1000' b.png
i tried using -sample apply transformation, it's not alpplied , stays in metadata - can check gimp.
convert a.png -repage '100%x100%+100+1000' -sample 100% b.png
i can't believe unable such simple thing.
updated answer
it hard understand want without proper images, here attempt @ guessing solution you. let's start image - ignore colours added them can see extent of images , can remove/change them anyway:
the new plan trim image there no border around letters @ , add in whatever border want afterwards. so, trimming existing border , adding 10px border left , right , 50px border top , bottom:
convert start.png -trim -bordercolor red -border 10x50 result.png
or, trimming original border , adding 10px border right side only:
convert start.png -trim -gravity east -background blue -splice 10x0 result.png
hopefully give approach achieve seek.
original answer
if want reset page offsets zero, easiest way is:
mogrify +repage image.png
or, harder:
convert image.png +repage result.png
Comments
Post a Comment