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
15
votes
3 answers

Can I save a huge PNG without the whole thing being in memory?

I'm saving a very large PNG (25 MB or so) with Java. The problem is that while it's being generated, it's using 3+ gigabytes of memory, which is not ideal since it severely slows down systems with low memory. The code I'm working with needs to…
Tom Marthenal
  • 3,066
  • 3
  • 32
  • 47
15
votes
4 answers

Transparent png on android market for high resolution asset

I'm trying to upload a logo with a transparent background to the android market. For some reason, my png is getting transformed by the market in a way that removes the transparency. My designer is doing his best to follow the instructions in…
emmby
  • 99,783
  • 65
  • 191
  • 249
15
votes
2 answers

Python: Extract Metadata from PNG

I am able to extract the necessary information using R, but for consistency within the overall project, I would like to be able to do it with Python (preferably Python3). I need the contents of a single tag called "Settings". This tag contains XML…
Lorem Ipsum
  • 4,020
  • 4
  • 41
  • 67
15
votes
3 answers

C#: Seeking PNG Compression algorithm/library

I need to compress or at least drop the quality of some png images that users are uploading to my site. I already resized it but that doesn't do much for the image size. Seeking a png/image compression or quality loss algorithm or library for .net…
Shawn Mclean
  • 56,733
  • 95
  • 279
  • 406
15
votes
3 answers

CSS - Add Color to Black & White PNG Image Using a Filter

Is it possible in CSS to add color to a black & white image using a filter? I'm talking about using filters like it's possible in Photoshop, and an even better example would be the ones in Microsoft PowerPoint. What I'm trying to do is this: I have…
Gal Grünfeld
  • 800
  • 3
  • 9
  • 32
15
votes
2 answers

Opening PNG with PIL/Pillow

I'm trying to use PIL/Pillow in Python to open a PNG image. You'd think it'd be trivial, but the images are showing up corrupted. Here's an example image: I tried loading it and showing it, using Python 3.4 and Pillow 2.7.0: $ python Python 3.4.0…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
15
votes
2 answers

PIL does not save transparency

from PIL import Image img = Image.open('1.png') img.save('2.png') The first image has a transparent background, but when I save it, the transparency is gone (background is white) What am I doing wrong?
Maxim Sloyko
  • 15,176
  • 9
  • 43
  • 49
15
votes
5 answers

Is it possible to create a circular (or any other non-rectangular) image?

All disc-shaped images I see are actually within a rectangular box, and have the sides (black portions in the below image) made transparent. Is it possible to have a circular canvas itself? Or were images always designed to be rectangular in…
Anirudh Ramanathan
  • 46,179
  • 22
  • 132
  • 191
15
votes
6 answers

How to read raw png from an array in python opencv?

I'm streaming a png image from my iPhone to my MacBook over tcp. The MacBook code is from http://docs.python.org/library/socketserver.html#requesthandler-objects. How can the image be converted for use with OpenCV? A png was selected because they…
Andy Rosenblum
  • 243
  • 1
  • 4
  • 10
15
votes
3 answers

How do I enable the pngcairo terminal in Gnuplot

I would like to plot a figure to PNG format (avoiding using convert), however my Gnuplot distribution does not offer the PNGCAIRO terminal. How can I install/enable it? I use Gnuplot 4.4, patchlevel 2 on Mac OS X 10.6. [me]machine @ test $…
TMOTTM
  • 3,286
  • 6
  • 32
  • 63
14
votes
1 answer

How to convert SVG into PNG on-the-fly

I try to convert an svg into PNG. the svg document is coming from a server as an Inputstream. First, I convert the svg stream into byte array with: byte[] streamBytes = IOUtils.toByteArray(svgStream); Then I convert the bytes into…
Kayser
  • 6,544
  • 19
  • 53
  • 86
14
votes
4 answers

php imagick convert PNG to jpg

$image = "[...]"; //binary string containing PNG image $file = fopen('image.tmp', 'wb'); fputs($file, $image); fclose($file); $image = new Imagick('PNG:image.tmp'); $image->thumbnailImage($width,…
rabudde
  • 7,498
  • 6
  • 53
  • 91
14
votes
3 answers

Rounded transparent _smooth_ corners using imagecopyresampled() PHP GD

I need a script which makes rounded transparent corners on supplied image. I've found one and it works good except the one thing: the applied corners do not look smooth. The imageantialias() throws Fatal Error since PHP is running on Debian and…
ᴍᴇʜᴏᴠ
  • 4,804
  • 4
  • 44
  • 57
14
votes
4 answers

Resize PNG image in PHP

I'm getting a no image display when resizing PNG however the following code works for JPEG. list($width_orig, $height_orig) = getimagesize( $fileName ); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width =…
Ian
  • 745
  • 2
  • 10
  • 20
14
votes
2 answers

PIL: How to make area transparent in PNG?

I've been using PIL to crop Images, now I also want to make certain rectangular areas transparent, say from PIL import Image im = Image.open("sample.png") transparent_area = (50,80,100,200) ...
Hoff
  • 38,776
  • 17
  • 74
  • 99