Questions tagged [png]

PNG (Portable Network Graphics) is an image file format designed to store raster graphics. It is associated with ".png" file extension. Use this tag for questions involving this specific format.

PNG was created to improve upon and replace (Graphics Interchange Format) as a losslessly compressed image file format not requiring a patent license.

PNG supports palette-based images with transparency, true colour images with or without alpha channel (RGB, RGBA), and grayscale images; PNG supports channel depths from 1-bit to 16-bit per channel. Interlacing, which allows the progressive display of partially downloaded images, is implemented via the Adam7 algorithm. Animation is supported by way of the extension.

More information

6735 questions
32
votes
5 answers

How to get alpha value of a PNG image with PIL?

How to detect if a PNG image has transparent alpha channel or not using PIL? img = Image.open('example.png', 'r') has_alpha = img.mode == 'RGBA' With above code we know whether a PNG image has alpha channel not not but how to get the alpha value? I…
jack
  • 17,261
  • 37
  • 100
  • 125
31
votes
5 answers

Drag and drop batch file for multiple files?

I wrote a batch file to use PngCrush to optimize a .png image when I drag and drop it onto the batch file. In the what's next section, I wrote about what I thought would be a good upgrade to the batch file. My question is: is it possible to create a…
Chaddeus
  • 13,134
  • 29
  • 104
  • 162
30
votes
5 answers

Java BufferedImage to PNG format Base64 String

I'm trying to get a screenshot output as a base64 encoded string but not getting very far. The code I have so far uses a Base64 library ( http://iharder.sourceforge.net/current/java/base64/ ): Robot robot = new Robot(); Rectangle r = new…
user72003
  • 425
  • 1
  • 5
  • 7
30
votes
5 answers

How would I load a PNG image using Win32/GDI (no GDI+ if possible)?

Is it possible to load a PNG from a file into an HBITMAP using Win32 GDI functions? If not, what would be the lightest solution without using external libraries (like libpng)?
jnm2
  • 7,960
  • 5
  • 61
  • 99
30
votes
2 answers

Loading PNG with stb_image for OpenGL texture gives wrong colors

I am using stb_image to load a 32-bit PNG file (RGBA) and I am creating an OpenGL texture with it. It works fine for 24-bit PNG files (with no alpha channel), but when I use a 32-bit PNG file, something goes wrong. This is what the texture should…
brettwhiteman
  • 4,210
  • 2
  • 29
  • 38
30
votes
1 answer

Looking for a research: PNG Sprite vs SVG sprite vs Icon fonts

We are currently using PNGs in production for icons, but as a designer I'm trying to push for using SVG's for the benefit of: a. Rendering on Retina. b. Visually impaired users that zoom in. c. An easier workflow when creating icons. Are there any…
Nir Benita
  • 511
  • 1
  • 7
  • 12
30
votes
5 answers

How to change the background colour's opacity in CSS

I have a PNG file which I give a background colour to its transparent areas, but I would like to make the background colour a bit transparent, like opacity. Here is my code so far: social img{ opacity:0.5; } .social img:hover { opacity:1; …
Alex Jj
  • 1,343
  • 10
  • 19
  • 30
29
votes
2 answers

Convert multipage PDF to PNG and back (Linux)

I have a lot of PDF documents that I want to convert to PNG, edit in Gimp, and then save back to the multipage Acrobat file. I'm filling out forms and adding scanned signature, trying to avoid printing, signing, then scanning back in, with the…
Marty Fried
  • 487
  • 1
  • 5
  • 12
29
votes
8 answers

Create a dynamic PNG image

I want to create a small function in PHP which takes in arguments like color, shape, transparency etc. and outputs a PNG image. I heard about PHP GD library but I want to know how can one create something as creative as soon.media.mit.edu
apnerve
  • 4,740
  • 5
  • 29
  • 45
29
votes
5 answers

imagemagick resizing and quality PNG

In my application I need to resize and make the quality on PNG files poorer. In full size the PNGs are 3100x4400px using 2,20MB disk space. When running the following command: convert -resize 1400 -quality 10 input.png output.png the images are…
jorgen
  • 1,217
  • 6
  • 22
  • 41
29
votes
7 answers

display huge Images in Android

I'm intending to display very large Images in Android. My first solution - to supply them as pdf - fails because not every handheld got a pdf-viewer preinstalled, and I don't want to require the users to install one. So I have a png now (width =…
Rafael T
  • 15,401
  • 15
  • 83
  • 144
29
votes
5 answers

PNG to eps conversion massive increase in file size

I'm converting an image from .png to .eps and it hugely increases the file size. Can anyone explain why this is, and how to prevent it increasing so much. I'm using Unix convert: convert image.png image.eps Thanks for any help
Freddie
  • 1,717
  • 2
  • 16
  • 23
29
votes
6 answers

How to show animated image from PNG image using javascript? [ like gmail ]

First of all,check out this image Gmail uses this image to display the animated emoticon. How can we show such animation using a png image?
Rakesh Juyal
  • 35,919
  • 68
  • 173
  • 214
29
votes
5 answers

Combine 2-3 transparent PNG images on top of each other with PHP

I am working on a custom avatar system for a project, but I have never really done much with the image side of PHP. I assume I need to use GD in some way, but I have no idea where to even start. Basically, there are a bunch of pre-made transparent…
James Simpson
  • 13,488
  • 26
  • 83
  • 108
29
votes
5 answers

Image resources for iOS

I'm probably missing something obvious here, yet I've been unable to solve the following problem: I have a project with image resources for both normal and retina screens, like someimage.png and someimage@2x.png, which are stored in a separate…
Vladimir
  • 9,683
  • 6
  • 36
  • 57