Author Topic: Use Crop on Image container  (Read 3944 times)

Offline cwiede

  • Newcomer
  • Posts: 30
Use Crop on Image container
« on: 2014 March 23 05:40:02 »
Hi, I'm trying to use the Crop-Tool to batch-increase the size of a set of images. At the beginning all the images have different sizes. I want to append additional (black) pixels on the right and the bottom of the images bringing all images to the same final pixelsize. I was trying with an image container, but it does not work. To all images the same number of pixels are added, hence I end again up with different sizes. Any suggestions?
Christof Wiedemair

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 627
    • Astronomy Pages G.W.
Re: Use Crop on Image container
« Reply #1 on: 2014 March 23 10:45:26 »
Hi Christof!
For these tasks i use StarAlignment. The reference image has the size i want to have all other
images. Than define the images in the StarAlignment box, run it and all aligned images will have the same size
as the reference image and all smaller images will get a black border.
If the result is ok you can stop here.
Or use Crop now for the resized images to add or crop additional columns and rows if you want.
Hope i understood your question correctly...

Gerald

Offline cwiede

  • Newcomer
  • Posts: 30
Re: Use Crop on Image container
« Reply #2 on: 2014 March 23 10:55:21 »
Hi Gerald,
thank you for your reply. In my images there are no stars and I don't want to have them aligned. Just added black pixels on the right and bottom in order to get the same pixelsize in a batch-mode. Any idea?
Best regards
Christof

Offline oldwexi

  • PixInsight Guru
  • ****
  • Posts: 627
    • Astronomy Pages G.W.
Re: Use Crop on Image container
« Reply #3 on: 2014 March 23 13:10:55 »
Hi Christof!
O.k., this can be solved with PixelMath.
You create a new image with PixelMath in the size you wish all images.
For example size 4000x3000 and Name it "b"



Than you create this PixelMath Expression

And pull the Image Container in the bottom line of the PixelMath Expression.

Thats it.
You will get all images in the size 4000x3000 and the data images aligned to left top
and will get a black border to right and bottom

if you want to change the size of the result you have to change the image width and height in the first and
second PixelMath Expression.

Hope this helps

"b" stands for black but can be any Name...

Gerald
P.S. EDIT
Just found out it would be more save to use in the second PixelMathExpression this extendend expression.
iif((y()<(h($T)+1)||x()<(w($T)+1)),pixel($T,x(),y()),pixel(b,x(),y()))   
instead of
iif(y()<(h($T)+1),pixel($T,x(),y()),pixel(b,x(),y()))
« Last Edit: 2014 March 23 13:34:54 by oldwexi »

Offline cwiede

  • Newcomer
  • Posts: 30
Re: Use Crop on Image container
« Reply #4 on: 2014 March 23 13:15:26 »
Ok, this looks promising! I'll try that tomorrow! Thank you very much!
Christof

Offline GJL

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Use Crop on Image container
« Reply #5 on: 2014 March 24 05:47:42 »
Hello Christof,

you can do it another way. Take the crop to your reference image, open its history explorer and transfer the green crop icon to every image.
Thats it.

Gerhard

Offline cwiede

  • Newcomer
  • Posts: 30
Re: Use Crop on Image container
« Reply #6 on: 2014 March 24 12:06:31 »
Hi Gerhard,
thank you, but this seems not to work as desired. The two images have different sizes. In fact in the code of the performed Crop-Action I don't find the new pixel size (e.g. 1000x1000) but only the increase in width and height (rightMargin, bottomMargin). But this increase is different for each image.
Best regards
Christof

Offline cwiede

  • Newcomer
  • Posts: 30
Re: Use Crop on Image container
« Reply #7 on: 2014 March 24 12:15:44 »
Hi Gerald,
the pixelmath-solution works perfectly. Thank you very much!
Christof

Offline GJL

  • PixInsight Addict
  • ***
  • Posts: 102
Re: Use Crop on Image container
« Reply #8 on: 2014 March 24 23:39:01 »
>> The two images have different sizes<<

Sorry Christof,

I didn´t see this point. And I´ll keep in mind the the solution of Gerald, if this problem occurs to me.


Gerhard