Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filling transparent area with color
#1
Hello,

I have tried with what I know, and have searched how to do what should be a fairly simple task yet no success.

I have a panorama image in the middle of the canvas.  I want to fill the lower transparent portion with a solid color.
Could somebody please tell me the tool option settings to do this with something like the bucket tool?  Once I have the solid color below my image I will want to erase the sky portion of my actual image to leave that area transparent.

Appreciate any help!

Dan


Attached Files Thumbnail(s)
   
Reply
#2
In Photoshop that would have just worked, but GIMP tries to be a bit more memory efficient by allowing layers to have a smaller boundary than the actual canvas if need be.  See that dotted outline around your panorama? That's the extent of the layer boundary, you will never be able to draw anything outside that boundary without modifying the layer boundary.

Over in the Layer's palette on the right, Right click the panorama layer, choose "Layer to image size". Now the fill bucket will work on the bottom half of the layer.

Removing the sky is one of those non-trivial things which you can use many tools to make your job quicker but is going to involve some manual editing along the way to get the final result you want. You have a lot of tiny soft areas like those trees without leaves which are not going to make it easy.

But you can non-destructively hide the parts of the image you don't like, by editing a "mask" that will allow you to define which parts of the panorama are invisible and which parts are not, without actually deleting any part of the panorama.

Right click the layer again, "Add layer mask", OK.  Now the layer has 2 boxes, one that represent the colour, and another white one that represents the mask.  You can edit either by clicking on one of those boxes. When you click on the white box, you can use any tool and draw on the canvas, to draw black to hide areas of the panorama you don't want, and draw white to unhide that area again if you don't like the change.

One thing that will help is using the Fuzzy Select wand (and play with the threshold value), but you have to click back on the colour box (not the white mask box) and shift+click all the sky colours (the large white area, the blue areas) till you've got something that mostly covers the sky area.  Then with this selection still visible, click the white mask box again to return to mask editing, and fill this selected area with black using the paint bucket.

You may want to touch up the result by zooming in and manually editing the mask with black or white using the Brush tool with different sizes.


Screenshots to help you with the sky removal:

Shift+click your way across the sky, keep shift+clicking in the dotted areas that aren't selected.
   

Select the mask (circled in red) and fill the selected area with black.
   

De-select the selection and then use a black paintbrush on the mask layer to clean up any bits you don't like, I demoed painting with black then white to show you how you can restore hidden parts again.
   
Reply
#3
Thank you very much for the response and tip Domarius! I will have a look at this once home from the office. I knew there had to be a fairly simple method, I just could not find it.

Dan
Reply
#4
Cool, I updated the post with some screenshots to help you.
Reply
#5
(12-01-2021, 09:31 PM)Domarius Wrote: Cool, I updated the post with some screenshots to help you.

With your tips it only took me a few minutes to get what I needed.  Here's what I have and how I use it.  I shoot deep space astrophotography from the field on the other side
of our back fence.  It's a large park as you could probably see in the original panorama.

The quality of the image and the fine trees really doesn't matter.  What it does it let me use this landscape in my planetarium so I can plan for what objects I want
to shoot and when they will become unobstructed by trees on the east side.  I have the rotation as perfect as it needs to be with lat lon plus altitude and it gives me a real
good idea what the sky will be like when I advance the time.

One thing that is kind of odd is the original top horizontal border for the panorama.  I still see that line but it does not interfere with the view and the stars, galaxies etc.
They still show through.

My image size was set to 2048 with a canvas size of 1024 so increasing that would probably give me "better resolution" if I wanted it.
In the screen shot here I have the pointer (circle) set on Polaris which is where we always line up our scope so tracking with the sky is correct.
I know that Polaris is right above one particular tree.

Again I appreciate the tips.  I tried this process about a year ago and while I did have something in the planetarium it was a really odd or obscure image, probably 
because I used the camera panorama mode instead of shooting individual pics like I did this time.


Attached Files Thumbnail(s)
   
Reply
#6
Another quick solution:

If you follow this one step by step, you should have a clean photo in no time:
Take your original image (2048 or resize it to 2048 pixel) and drop it in GIMP

Make your canvas the size needed in height Image ➤ Canvas size...,
Then right click on your unique layer Layer ➤ Layer to image size

Then, In the Channels dialog ➤ take the red channel and drag 'n drop it on the image/canvas (by doing so once drag n dropped, you might have selected the red channel, if so ➤ unselect by clicking on it again)
   

Go back to your layer stack and select the red channel layer
Then Colors ➤ Threshold... (adjust the slider until all the sky-part is white, but not more or the foliage will start to disappear)
   

Then Edit ➤ Copy
Make this layer (the channel) invisible (un-tick the eye)
Select the original image/layer ➤ Add a mask (white full opacity)
   

Then Edit ➤ Paste
Then, Click on the anchor at the bottom of the layer stack
   

Then Colors ➤ Invert (the hard work part is done, the sky is now removed Wink )
Then Select the layer itself(click on it) to deselect the mask
Now you can add your bucket color on a new layer below or inside a selection below your panorama, then export as png to keep the transparent area

Before to export, If you do need to adjust the foliage visibility ➤ Click on the mask to select it, then Filters ➤ Distorts ➤ Value propagate... more white will increase the foliage, more black will decrease the foliage (but may be it's for an another "tuto")
Reply
#7
(12-02-2021, 06:26 AM)PixLab Wrote: Another quick solution:

If you follow this one step by step, you should have a clean photo in no time:
Take your original image (2048 or resize it to 2048 pixel) and drop it in GIMP

Make your canvas the size needed in height Image ➤ Canvas size...,
Then right click on your unique layer Layer ➤ Layer to image size

Then, In the Channels dialog ➤ take the red channel and drag 'n drop it on the image/canvas (by doing so once drag n dropped, you might have selected the red channel, if so ➤ unselect by clicking on it again)


Go back to your layer stack and select the red channel layer
Then Colors ➤ Threshold... (adjust the slider until all the sky-part is white, but not more or the foliage will start to disappear)


Then Edit ➤ Copy
Make this layer (the channel) invisible (un-tick the eye)
Select the original image/layer ➤ Add a mask (white full opacity)


Then Edit ➤ Paste
Then, Click on the anchor at the bottom of the layer stack


Then Colors ➤ Invert (the hard work part is done, the sky is now removed Wink )
Then Select the layer itself(click on it) to deselect the mask
Now you can add your bucket color on a new layer below or inside a selection below your panorama, then export as png to keep the transparent area

Before to export, If you do need to adjust the foliage visibility ➤ Click on the mask to select it, then Filters ➤ Distorts ➤ Value propagate... more white will increase the foliage, more black will decrease the foliage (but may be it's for an another "tuto")

You guys are better than paid support!  Thank you for taking the time to screen cap all the steps.  I've had GIMP for years just used it for basic stuff never really learned how to use many of the tools, layers, etc.  I'll take a copy of my pano and play with it some using these techniques.  What I have now for my imaging needs is perfectly fine, all I need to know is when will my target be above the trees, building, poles etc.  I'm going to research the end use and see if sizing and resolution will make much difference and if so what the specific requirements are for the file.

I'll include a couple of my latest images here.  I use Pixinsight to do the processing for these images from hundreds of single photos and calibration frames captured on a cooled monochrome camera.  It's taken me a couple of years and I'm getting better but still don't have an image that I consider worthy of publishing or printing.

Thanks again for helping an old guy out  Cool

I did find info on what the image size needs to be.

IMPORTANT: Make sure all textures have dimensions which are integer powers of 2, i.e. 256, 512, 1024, 2048, 4096, 8192, 16384, ... e.g. 4096 by 1024, 2048 by 2048 and so on.

This is a limitation of OpenGL. Some video hardware will work OK with images with different image dimensions, but many will not display properly, suffer vastly reduced frame rates, and even crash the computer.

I'll bump it up or should I say do a little less reduction from the original and see if the quality improves some.


Attached Files Image(s)
       
Reply
#8
(12-02-2021, 01:53 AM)Dan Bryan Wrote: One thing that is kind of odd is the original top horizontal border for the panorama.  I still see that line but it does not interfere with the view and the stars, galaxies etc.
They still show through.

My image size was set to 2048 with a canvas size of 1024 so increasing that would probably give me "better resolution" if I wanted it.
In the screen shot here I have the pointer (circle) set on Polaris which is where we always line up our scope so tracking with the sky is correct.
I know that Polaris is right above one particular tree.

Again I appreciate the tips.  I tried this process about a year ago and while I did have something in the planetarium it was a really odd or obscure image, probably 
because I used the camera panorama mode instead of shooting individual pics like I did this time.

If you dragged another image into your canvas, it will be on its own layer, with its own boundary, so it will show through fine if your panorama layer (with its smaller boundary) is on top.  It's when you try to draw into a layer with a smaller boundary than you expect that you're going to have the problem you had in the first post. Just right click any layer and set them all to Image size to avoid the issue in the future.

If you know your image is 2048 (wide, or high?), then make sure your canvas is at least this size to make the most use of your photo detail Smile

It's hard to know what you mean by "odd or obscure" image but I'm guessing it was a lower resolution and your 2048 (wide?) image will look better.

(12-02-2021, 02:08 PM)Dan Bryan Wrote: I did find info on what the image size needs to be.

IMPORTANT: Make sure all textures have dimensions which are integer powers of 2, i.e. 256, 512, 1024, 2048, 4096, 8192, 16384, ... e.g. 4096 by 1024, 2048 by 2048 and so on.

This is a limitation of OpenGL. Some video hardware will work OK with images with different image dimensions, but many will not display properly, suffer vastly reduced frame rates, and even crash the computer.

No - ignore that, you found some info that's only relevant to using an image as a texture on a 3D model for a video game, running in real time. You're editing a photo, this is not even remotely the same thing, so don't worry about those numbers you read there.  Make your canvas any size you need to, just see what the final result looks like. For this kind of task, if it looks right to you, it's right.
Reply
#9
That's exactly what this is used for, a real-time representation of the sky relative to your current surroundings along with time and date.  You might have a planetarium app for your phone such as sky safari or in this case Stellarium.  

Without installing you can check it out here   https://stellarium-web.org/   to see how it's actually being used.

The quality of my landscape image doesn't really matter.  All I need to know is when will my target for the night clear the trees or any other obstructions.  I might shoot 5 minute pics for 6 hours and this lets me see about where the telescope is going to start and finish with that particular target.
Reply
#10
(12-02-2021, 03:34 PM)Dan Bryan Wrote: That's exactly what this is used for, a real-time representation of the sky relative to your current surroundings along with time and date.  You might have a planetarium app for your phone such as sky safari or in this case Stellarium.  

Without installing you can check it out here   https://stellarium-web.org/   to see how it's actually being used.

Ohh, now I have a clearer idea of what you're getting up to.  Yes in this case it's relevant!  Stick to power of two sizes, AND square images.  The longest dimension will cause that same size square of memory to take up, so if you have an image 2048 wide but only 1024 high, it will still take up 2048 x 2048 area of graphics memory, so you may as well use up the extra height. 

Likewise, if for some reason there's a performance issue (there shouldn't be in this case), you'd need to bring the image size down by one whole power of 2 at a time, to see any difference. Eg. next step down from the above would be 1024 x 1024.   Anything more than that will still use up 2048 x 2048 of  graphics memory.  That's what that quote you found is trying to say, but badly;
Quote:This is a limitation of OpenGL. Some video hardware will work OK with images with different image dimensions, but many will not display properly, suffer vastly reduced frame rates, and even crash the computer.

It's not that non-square images will "crash the computer" - what they're trying to say is, one might inadvertently use more graphics memory than they intended, eg. if they used a really wide but short image, if the graphics memory was ever overflowed, the program will probably crash. Pretty difficult to do in your situation, IMO.

Also "limitation" is the wrong word, it's more of an "optimisation", sticking to power of 2 sizes is one of the many reason real time 3D graphics can run as fast as they do.
Reply


Forum Jump: