Reduce size of a .png image without losing transparency - image

Basically, I'd like to resize or resample a .png image (in order to reduce its file size) and yet retain it's transparency.
Anybody got an idea how best to go about this?
Thanks.

You can use paint.net, it is a free tool. Although it is pretty basic, it does the job.
Go to Image > Resize

Stumbled upon this thread and found the following site that does exactly what is requested: https://onlinepngtools.com/resize-png

What graphics program are you using?
Photoshop does this by simply going thru IMAGE > IMAGE SIZE and resizing. Transparency is not affected.
I'm sure Paint Shop Pro does the same

I know this is an old question, but the answer that worked for me was to use Inkscape.
Start Inkscape (free on Inkscape.org).
File -> Import... (Ctrl+I) the PNG file you want to resize (defaults on import dialog are ok).
With the image you just imported selected, select File -> Export PNG image... (Shift+Ctrl+E)
In the Export PNG Image tool pane, click the Export As... button to set the output filename and location.
In this same tool pane, set the image size using width/height or pixels.
In this same tool pane, click the Export button to create the output file.
This worked for me, hope it helps someone else.

Providing the image you have created / have been working on is transparent in the first place, using the "Resize" or "Resample" tools in any major image editing package (e.g. PhotoShop, PaintShop Pro and so on) should not affect (or lose) the transparency at all.
I use PaintShop Pro (X6, 64 Bit) myself and typically find that the "PNG Optimizer" option offers more options along these lines (than the default "Save As > .png" route).
Hope that this helps (specific to PaintShop Pro Users) in relation to the source question.

While I was waiting for the downloads of other image editing softwares, I tried Microsoft Power Point and succeeded in preserving the transparency.
Drag the image inside any slide, crop or resize, then save as a new picture as .png.
You can drag the image back in ppt to confirm the transparency is maintained

The complete Autodesk Sketchbook is now out for free including all the previous premium features such as resizing an image.
You do it as you would in paint by clicking on Image > Image Size... and then you can save as a .png without losing transparency.

Image size can be reduced by reducing number of colors and there are online tools to do this .
Try these..Hope they solve your problem
https://tinypng.com/‎
http://pngcrush.com/ and
http://tools.dynamicdrive.com/imageoptimizer/ --It provides more output images with different number of colors. However, smoothness will be effected, take care.

Related

Working with Images in Xamarin App programmig

I am working on a Xamarin App compatible with all devices. I have a general question related to images. I am using Location Mark Image Icons to provide locations available on the Map. My issue is, Image has a white background which is also showing along with its background. I want to show only the Image.
Is this related to the designer to provide the image without background? Or as a developer, I can do something on it.
Xamarin.Forms doesn't delete your white background. What you need to do is following a small tutorial on how to use Adobe Photoshop for example and export your images as png, you might even consider which png type you need, there's 3 types of png:
png8
png24
png32
I won't be going deep in explaining each one of them, but you need to know that they all support transparency and could have a transparent background, however, you might notice some differences between them on the edges.
For example, png8 will give a small white border while png24 will not show that.
You can check this for example: https://helpx.adobe.com/photoshop-elements/using/optimizing-images-png-24-format.html
No, you can't do anything about it using Xamarin.Forms. You need to modify the image and remove the background (using Adobe Photoshop, etc.) and make sure to save it as .png.
If its simple white background you want to remove, You can utilise simple [MakeTransparent][1] method ofBitMap.
But this will remove all white coloured pixel. So IF your logo also contains white color, better you contact your designer.

Netlogo : Set Size and Position of drawing

I have created a Netlogo program in which I imported cars using following code:
import-drawing "F:\\BMW.png"
It imports the image as background and stretches the image in whole screen. I want to resize it, but cannot do it using set size 2 as its used for resizing of built in shapes (as far as I know). Can someone please guide me how can I resize my PNG image and also set it to a specific coordinates (say 0,14).
Any help will be appreciated. Thanks
It won't change anything for how your model works, so you can just use:
set-patch-size XXX
If you dont want to guess at what patch size you want, you can just drag the size smaller until it's about the size you want, then click on info for GUI and it will have a patch size there.
I'm not sure what you mean by resize your png however.

App Icon appearing small in Xcode Deployment Info

I'm running out of hair to pull. I created two icons:
icon#2x.png (114x114)
icon.png (57x57)
For some reason they appear half sized, however. See this screenshot:
https://docs.google.com/open?id=0BxSFZAq0OUFGbXFWbWNTVlo3RHc
I'm 100% confident my icon sizes are as described. Any ideas why this might happen?
Some side notes that may or may not be relevant:
- I'm using PhoneGap + JQueryMobile, not that that should mapper
- I dragged a reference to the two icons into the Resources/icons folder, replacing the original icon.png and icon#2x.png files.
I had this problem as well. I experimented and discovered that it is related to the pixels/inch resolution. icon#2x seems to want 150 pixels/inch for full size, 300 pixels/inch gives half size, and 600 pixels/inch (which is what I was using) gives quarter size. As near as I can tell, image resolution didn't really have that much of an impact on the quality of the image when placed on an iPhone. My icon is very sensitive to rendering, so any degradation of image quality would have been readily noticeable.
Changing all the icons to 72dpi from 300dpi solved my problem.
Check the icon, as this is png image there was transparent background so crop the png file that starts with postion where blue color starts in the image. This solves your problem
I just had the same issue. My solution was to just open them in Xee (probably lots of other programs will do the trick) and resave them as png. My icons were originally created in gimp and this may something to do with they way that gimp saved them.
Exactly same thing happened to my defaults files - the same solution fixed it.
I had this issue when creating assets with Gimp. To solve it I unchecked "Save resolution" in the export dialog.

Setting Image Sizes In Windows Phone

Windows phone asks for specific image sizes when submitting an application. When I take the image I wanna use and resize it to the dimensiond they want it distorts the image. If I keep it proportional Ill never get the exact sizes they need. What do you guys do to resolve this?
I used Photoshop. Open the image, choose "Image" > "Canvas Size". That will adjust the size of the image without distorting it. I am sure you can also use any of the free image applications like gimp http://www.gimp.org/

Find logo in desktop screenshot

I need to develop a desktop application which will
1.) have a list of the Different Application logos (Background Transparent) e.g. IE, FIREFOX, CHROME, PHOTOSHOP ETC.
2.) User will take a screenshot of desktop and save the image.
3.) Now my application need to search all the logos in the screenshot image and tell which all logos are present and where.
4.) I used OPENCV, it's working, but when user changes the desktop background & captures screenshot, it's not working as the transparent area of logo is getting the desktop background content.
Can somebody provide a solution or libraries open source, commercial to do this job.
This is easy to do using cross-correlation.
See my answer to this question.
Basically:
Start with desktop image and one template image for each icon
Apply edge detection (e.g. Sobel) to the desktop image and template images.
Throw away the original desktop image and templates, you won't need them anymore cause we'll be using the edge-detected images
For each template
Do template matching as you normally would
Threshold the maximum of the result. If it's above the threshold, you have a match at that position. Otherwise, no match.
If your icons are aligned in a grid on the desktop, you may be able to speed up your processing by only checking those specific grid positions.
EDIT
You can also save a lot of time by knowing which icons to search for. If you have access to the file system, then just look for *.lnk files (or any other extensions you may be interested in) in the directory that corresponds to the desktop (can't remember exactly what it is, but for Windows7 it's something like c:\users\misha\desktop). That will tell you what icons are there on the desktop. This will allow you to shorten your template candidate list before you go and do the template matching.
I like misha's answer and I think it should work for you. But it that doesn't work you could try replacing the transparant pixels in your reference logo with uniformly distributed random noise before trying the match. This will make the transparant pixels irrelevant for any matching computation because they will match just as bad no matter what there is on the desktop in those pixels.
I'm not familiar with the tools you're using, but I'm guessing you have to either:
a) Tell your program to ignore transparent pixels in the icon images during the comparison operation.
OR
b) Tell your program to treat transparent pixels in the icon images as "wildcards" which can be any color.

Resources