Zeroing channels of cut out area - gimp

I imagine there is probably going to be an easy solution for this in GIMP, but I for the life of me can't figure it out.
I'm using the color picker tool with the use info window selected to verify pixel values.
Basically, I have some pixels in an image that I need to zero out. By that I mean I want the RGBA values to all be set to 0.
I attempted to:
use the rectangular select tool to select the group of pixels
use bucket fill to set the pixels to black with opacity set to 0.0
Then, to verify it was done correctly, I use the color picker to test the value of the rectangle I just filled.
Unfortunately, it seems to just contain the previous value. What am I missing here?

The "opacity" of the bucket-fill is the opacity of the paint, not the opacity of the resulting pixels. In other words the less opaque it is, the less visible the result. What you want to do is bucket-fill selection with black, then [delete].

Related

Creating a transparent color within a string palette

I am working within Google Earth Engine and am trying to create a no-color/completely transparent color (no boarder and no fill). Below is a line of code where the first color should be the transparent "color". Basically I want my min value to not show up in the map at all.
Map.addLayer(image, {min: 0, max: 3, palette: [transparent, '#0571b0', '#FFDF00', '#ca0020']},'image');
I have tried creating a variable to set a color as completely transparent (change the opacity to 0), but the palette command cannot take variables. Only strings. I've also read SVG fill color transparency, but do not understand how to change the opacity of that specific color without creating a variable (which again, palette doesn't allow). Lastly, I tried adding 00 to the end of another color, but that did not work either.
Any suggestions?
Update:
I was never able to find a solution to this and ended up just going with a white back ground. It was purely for a nicer aesthetic look to allow a basemap to be seen. If I ever come across a solution, I'll be sure to post it.
I had the same question. I found the solution in the developer group.
See the answers: https://groups.google.com/g/google-earth-engine-developers/c/WcxtEIzudxw/m/GscOlsQhDgAJ
The Solution:
// create your previous mask
image = image.eq(1)
// mask and set the opacity
image = image.mask(image.mask().where(image.eq(0),0.0))

Apply PanoTools alignment to individual images

I have batch of images (timelapse fotos) which I aligned using
align_image_stack from PanoTools, because the have some small shifts. The required positional shift relative to the first image is specified as roll/pitch/yaw values in the output PTO file. How is it possible to apply excatly these positional shifts to the images? I mean if it gets shifted to the right for example, then it gets some (black) border at the left and cropped off at the right.
Then I could afterwards crop out the area inside the border to get an unshifted timelapse.
I just realized the -a option of align_image_stack does this!

Rounded textBox

Is ShapeRenderer class has the ability to do this,I would like to create boundaries for a custom object (such as a rectangle with rounded corners) and then fill it.And after that some text on that filled rounded box.
shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
//shapeRenderer.line(...);
shapeRenderer.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments);
shapeRenderer.line(...);
shapeRenderer.curve(...);
shapeRenderer.line(...);
shapeRenderer.curve(...);
shapeRenderer.line(...);
shapeRenderer.curve(...);
shapeRenderer.setColor(Color.BLACK);
shapeRenderer.fill();
shapeRenderer.end();
Any suggestion to do it in libgdx.
As Lestat said, you can use Scene2d.
Whether you are using Scene2d or not, a NinePatch would probably be suitable if you want to draw a rounded rectangle that scales well (check this link).
If you want to be able to set the color of your image/control, you can use NinePatch.setColor().
Here are two example scenarios regarding colors:
You will always have a black stroke/outline, and an arbitrary fill. In this case make the original image have black stroke/outline and white interior. When you 'tint' the image using NinePatch.setColor(), the stroke/outline will be unaffected and will remain black, while the interior (fill) will be the same as the color provide to the mentioned method.
You have arbitrary fill and arbitrary stroke. In this case you need 2 separate original images. First one would contain the 'fill' and would be completely white. Second one would contain the 'stroke' in white color and would be transparent inside. When drawing you would draw first the fill with its tint and then the stroke with its tint and that's all.
If for some reason you needed different corner curve radii, you would probably need separate images (or image pairs) for each radius to get the best result.

Non-scaling / absolute gradient for scatter plots in CorePlot?

I've added a gradient to my scatter plot in the usual manner:
CPTFill areaGradientFill = [CPTFill fillWithGradient:areaGradient1];
boundLinePlot.areaFill = areaGradientFill;
boundLinePlot.areaBaseValue = 0;
Setting the minimum for the gradient is easy to do with the areaBaseValue property. However, the gradient will always stretch such that the entire range of color defined by areaGradient1 appears below the line plot.
What I'd like to do is set an absolute y-axis range (e.g., 0 to 100) and have the gradient always be set to that range. So if my line is at y=50, only the bottom 50% of the gradient would be rendered below the line. I thought setting boundLinePlot.areaBaseValue2 = 100; would do this, but it doesn't have any effect.
Does CorePlot support this? If not, what's the 'right' way to go about implementing it?
(This is my first question so apologies if I'm not clear. Be gentle. :) )
While there's no direct way to make this happen you could use a trick. Make your horizontal global range wider than what you would show normally and do not make the graph horizontally scrollable. Add a value to the graph in the hidden area that is always your maximum value. This will be filled with the full gradient. Other parts however will only get a partial gradient, depending on their height.
I found this trick by accident while looking at one of my graphs. Look:
The overview at the top shows where the big graph is currently (the green limit band). Now compare this with another part:
You can clearly see that the tip of the large value has a different gradient value as the tip of the smaller one.
You can use a "background limit band" to draw a fill at a certain size behind the plots, but that won't be clipped to the plot line.

iOS White point/white balance adjustment examples/suggestions

I am trying to change the white point/white balance programmatically. This is what I want to accomplish:
- Choose a (random) pixel from the image
- Get color of that pixel
- Transform the image so that all pixels of that color will be transformed to white and all other colors shifted to match
I have accomplished the first two steps but the third step is not really working out.
At first I thought that, as per Apples documentation CIWhitePointAdjust should be the thing to accomplish exactly that but, although it does change the image it is not doing what I would like/expect it to do.
Then it seemed that CIColorMatrix should be something that would help me to shift the colors but I was (and still am) at a loss of what to input to it with those pesky vectors.
I have tried almost everything (same RGB values on all vectors, corresponding values (R for R, etc.) on each vector, 1 - corresponding value, 1 + corresponding value, 1/corresponding value. RGB values and different (1 - x, 1 + x, 1 / x).
I have also come across CITemperatureAndTint that, as per Apples documentation should also help, but I have not yet figured out how to convert from RGB to temperature and tint. I have seen algorithms and formulas about converting from RGB to Temperatur, but nothing regarding tint. I will continue experimenting with this a little though.
Any help much appreciated!
After a lot of experimenting and mathematics I finally got my app to work almost the way I want.
If anyone else will find themselves facing a similar problem then here is what I did.
I ended up using CITemperatureAndTint filter supplying a color in Kelvins calculated from the selected pixels RGB value and user suppliable tint value.
To get to Kelvins I:
- firstly converted RGB to XYZ using the D65 illuminant (ie Daylight).
- then converted from XYZ to Yxy. Both of these conversions were made using the algorithms found from EasyRGB.
- I then calculated Kelvins from Yxy using the McCamry's formula I found in a paper here.
These steps got the image in the ballpark but not quite there, so I added a UISlider for the user to supply the tint value ranging from -100 to 100.
With selecting a point that should be white and choosing values from the positive side of the tint scale (all the images I on my phone tend to be more yellow) an image can now be converted to (more) neutral colors. Yey!
I supplyed the calculated temperature and user chosen tint as inputNeutral vector values.
6500 (D65 daylight) and 0 as inputTargetNeutral vector values to CITTemperatureAndTint filter.

Resources