As a part of an experiment I'm trying to process images edited in . I am erasing parts of the image like a brush by drawing on it with
ctx.globalCompositeOperation = "destination-out";
I'm converting this canvas to image with ctx.toDataURL() and saving this in the server with a base64 conversion. So the saved image at this stage looks like this:
The white areas are actually transparent. Now I'm putting this same through the Pillow imageEnhance module:
path = imgName
imObj = Image.open(imgName)
enhObj = ImageEnhance.Contrast(imObj)
enhObj.enhance(factor).show()
Though the contrast adjustment has happened properly this is how the image looks:
Any idea why this is happening and how to tackle this?
Its a problem with the application show() is calling which in this case is some Imagemagick viewer. Once saved to disk the image rendered properly. The problem with lossy transparency however still exists with desaturation through ImageEngance.color() module.
Related
im making an animation of some product that listens to you and reacts accordingly,
however, i want to upload my animation to my webflow project
my animation resolution is 1080x720, however i export the keyframes as PNG images (like webflow tutorial recomends) and then i import those images inside a new After Effects project and then i export the animation (I would like to say that I follow each step of the tutorial exactly as it is) but the problem comes when i test my result json inside LottieFiles previewer, the animation looks stretched (i cant explain it so ill upload 2 images to show the problem)
the original frame is a png image used in the bodymovin sequence
the json output frame is a base64 image (the first frame of animation) stored in the bodymovin animation result data.json
the two images above are the same resolution but looks diferents, i want to know why and how to fix it
thanks in advance
link to the original webflow tutorial that i follow
sorry this was just a problem of configuration, i figured out how to fix this, i just have to set bodymovin settings > assets > "Copy original a Assets" turn on, in fact, bodymovin use a low-level AI that remove the white / transparent padding and expand the content, enabling original Copy forces bodymovin to avoid using that AI
I have just downloaded the dataset caltech101 and I want to resize the image into the shape of (200,300,3). As I have read, I first need to convert the image into a tensor and then resize it using tf.image.decode_jpeg. But I don't know how to start from scratch with an image and turn it to a tensor.
(I'm a beginner in learning machine learning)
To load an image using TensorFlow, first decode it like so:
image = tf.image.decode_jpeg(...)
To resize it, use the image from the code above, like so:
resized_image = tf.image.resize_images(image, [299, 299])
You can find more on their API documents here.
I am trying to save the content of an ImageView into a file and save it as an image. The simple code snippet which I am using is:
writeImageToFile(imageView.image);
The function writeImageToFile, saves the blob in a file which contains the image displayed in the image view. All good and fine till here.
Now the point noticed in here is that, I have defined the ImageView with the width and height as 150dip. After saving the image into a file, for iPhone 5, we find that the image resolution is 300x300, and for iPhone 6 Plus it is 450x450. The image resolution varies with the screen density, which I can understand.
But my query is that is there any way to always keep the resolution fixed to 150x150 pixels. Am not sure if this is possible out of the box with Appcelerator or do we need to use external modules.
Note: This is also applicable for Android too.
You can use the Blob functions to check the image size, then decide if you need to resize. You can use imageAsResized (http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Blob-method-imageAsResized) to make a 150x150 image.
I would like to be able to use the cpselect matlab tool (or a similar one) with the capability of showing both images (moving image and reference image) in RGB (I only managed to see moving image in RGB and reference image in grayscale).
Could someone point me to an alternative for this tool that would support this or anyway to be able to display both image in rgb in cpselect?
Thanks in advance.
Not sure what you're talking about, and I'm quite confused about your statement. cpselect is image independent. You can show both of them as colour or grayscale or one or the other. The example you're probably looking at is the one that comes with MATLAB: http://www.mathworks.com/help/images/ref/cpselect.html . One image is grayscale, while the other has a pinkish hue.
Here's an example showing both the source and target image as being in colour. I used onion.png that is a colour image that is part of the MATLAB system path:
im = imread('onion.png');
im_rotate = imrotate(im, 35);
cpselect(im, im_rotate);
We get:
this question is in close relation to Firefox 3.5 color correction hack?
The situation I have is that there's a canvas game of mine, and the images that are used in it carry additional information about their shape, connection points etc. This information is stored in the PNG image itself, using meaningful colours (eg RGB(255,255,0) for connection point).
Loading element and painting on the canvas creates Image object, img.src is set, and in img.load function I preprocess image data reading the sensitive information (and removing sensitive pixels from the image data before painting to canvas).
The problem: In FF, the pixel which was supposed to be 255,255,0 is actually 255,254,0. I don't have problems with FF color correction (I don't care if the displayed image has right colors, or slightly modified), but I'd expect that getting image data gives me uncorrected data. I'm looking for a solution which would not involve changing images on the server. Is there some way? Eg.
img.setColorProfile(), or
img.disableColorCorrection(), or
img.getImageData(disableColorCorrection) or img.getImageData(colorProfile)?
The problem might have do more with image loading than image drawing.
I think the proper solution is to strip out color profile information from the images (which you seem to want to aovid). If possible server another image resources for Firefox if you cannot need to have the original data intact.
http://f6design.com/journal/2006/12/01/fixing-png-gamma/
Also, you could decode PNG immages in pure Javascript if the server is co-operate and allows CORS and AJAX loading of the images. You decode the image in Javascript using png.js and create a source <canvas> from the image data (instead of <img>). This way it's you in the control what RGB values comes out from each PNG pixel.
https://github.com/devongovett/png.js