How to move an object on an image

XnConvert Multi Platform - Windows, MacOSX, Linux
tbmuc
Posts: 8
Joined: Thu Nov 02, 2017 11:04 am

How to move an object on an image

Post by tbmuc »

Hello,

I have some transparent png files with different resolutions and an object in the middle and transparent space around. How can I convert it to a file with the same resolution with the object on the bottom.
cday
XnThusiast
Posts: 3076
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to move an object on an image

Post by cday »

tbmuc wrote: Fri Jan 15, 2021 8:38 pm I have some transparent png files with different resolutions and an object in the middle and transparent space around. How can I convert it to a file with the same resolution with the object on the bottom.
Are you able to upload an example image?

Do all the files have the object in the same position, and require it to be moved to the same position at the bottom?
tbmuc
Posts: 8
Joined: Thu Nov 02, 2017 11:04 am

Re: How to move an object on an image

Post by tbmuc »

>Are you able to upload an example image?

Unfortunately I'm not. It's forbidden by the license.

>Do all the files have the object in the same position, and require it to be moved to the same position at the bottom?

No they aren't . The images contain different dog breeds which are at a random position. There are small dogs and large dogs, the size shall not change. But it should be filled with transparent space to a unique resolution.
cday
XnThusiast
Posts: 3076
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to move an object on an image

Post by cday »

It would be useful to have a representative image to test two ideas I have, but I suppose you can't easily create one that you can be sure is technically representative?

Otherwise, I can give you some ideas but that will take more time and they may not work...
tbmuc
Posts: 8
Joined: Thu Nov 02, 2017 11:04 am

Re: How to move an object on an image

Post by tbmuc »

Lets explain it quite easy. You have a rectangle in a 2000x2000 transparent png. Everything may differ, its size and its position. At the end it may be in the midth of the botton of a 4000x4000 transparent gif.
cday
XnThusiast
Posts: 3076
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to move an object on an image

Post by cday »

The problem is that there are different types of transparency and it is not a subject with which I am very familiar, and you quite possibly can't easily create a test image with good confidence that it is representative...

If you are unable to provide a test image, I can give you some ideas but I would have to try to describe them carefully, and without being able to test them they might not work.

Edit:

I have created a transparent test image that may, or may not, be representative of your transparent images, and the two possible methods of moving an object in the image that I was considering both function as hoped: I'll post details tomorrow.

Note that as each of your images has different repositioning requirements, you may have to process them individually unless you can sort them into groups, depending on the final positioning accuracy you require.

OK, I think it is not too difficult if your images are similar and you are prepared to modify each one individually, it should be reasonably quick.
tbmuc
Posts: 8
Joined: Thu Nov 02, 2017 11:04 am

Re: How to move an object on an image

Post by tbmuc »

The problem is, that they aren't unique. It's a set of collections of hand drawn pictures by different artists. Every time I'm looking for what they have in common, I get surprised.The aim is to make them unique. May be xnview is the wrong tool. I'm looking for two steps.

A gimp like command cut it to content.
A Imagemagic like command. Place object to the south of a new canvas.
cday
XnThusiast
Posts: 3076
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to move an object on an image

Post by cday »

tbmuc wrote: Sat Jan 16, 2021 5:45 am The problem is, that they aren't unique. It's a set of collections of hand drawn pictures by different artists. Every time I'm looking for what they have in common, I get surprised.The aim is to make them unique. May be xnview is the wrong tool. I'm looking for two steps.

A gimp like command cut it to content.
A Imagemagic like command. Place object to the south of a new canvas.
I can give you a method of changing each image individually by eye, actually very easy and even obvious, but there is no support in XnView software for cutting to content, and I have been assuming in the absence of an example image that there is no other content on the transparent background that could interfere...
tbmuc
Posts: 8
Joined: Thu Nov 02, 2017 11:04 am

Re: How to move an object on an image

Post by tbmuc »

I was able to cut the images selecting the upper right pixel. The remaining step is to increase the canvas. When doing this the canvas is filled white. How to make it transparent?
cday
XnThusiast
Posts: 3076
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to move an object on an image

Post by cday »

tbmuc wrote: Sat Jan 16, 2021 10:11 am I was able to cut the images selecting the upper right pixel.
Could you elaborate on how you did that, using XnView software?

The remaining step is to increase the canvas. When doing this the canvas is filled white. How to make it transparent?
You used XnConvert 'Canvas resize' action? As said I'm no expert on transparency, but try setting Alpha = 0 ?

[I am currently writing up my suggested basic move method, which may or may not meet your needs, it is unlikely to be possible to batch it.]
tbmuc
Posts: 8
Joined: Thu Nov 02, 2017 11:04 am

Re: How to move an object on an image

Post by tbmuc »

Thank you very much, now its almost as I need it.

BTW: this is a repetitive task and I have to avoid much manual work. If it takes to much time, the project has to be canceled.
cday
XnThusiast
Posts: 3076
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: How to move an object on an image

Post by cday »

You didn't answer my first question asking how you cut the images by selecting the upper right pixel! Using XnConvert? :?:
tbmuc wrote: Sat Jan 16, 2021 10:46 am BTW: this is a repetitive task and I have to avoid much manual work. If it takes to much time, the project has to be canceled.
If you are able to batch convert satisfactorily using XnConvert that should be a good solution. :D

I intend to write up the basic method I evolved for the benefit of anyone in the future discovering the thread: it should be quite quick per image but clearly there would be a practical limit to how many images could be processed. But if some images are not processed satisfactorily using batch conversion, manual processing of those images might be practical. Right now the sun has come out and I'll take a break!