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
23
votes
7 answers

Can an HTML img tag have multiple src attributes?

Much like how the video tag can provide multiple source attributes so an mp4 video can fall back to an ogg video, I would like to get an svg image to fall back to an png image.
Jason Christa
  • 12,150
  • 14
  • 58
  • 85
23
votes
2 answers

.NET Image.Save occasionally generates a PNG with a bad IDAT chunk

I have a C#/.NET utility I wrote that loads PNG images from disk Bitmap b = Bitmap.FromStream(new MemoryStream(File.ReadAllBytes(filename))) as Bitmap; performs several transformations on them (rotation, scaling, alpha) and then saves the resulting…
David Welch
  • 369
  • 1
  • 9
23
votes
3 answers

Create a transparent png file using PHP

Currently I would like to create a transparent png with the lowest quality . The code:
user782104
  • 13,233
  • 55
  • 172
  • 312
23
votes
4 answers

How do I blit a PNG with some transparency onto a surface in Pygame?

I'm trying to blit a PNG image onto a surface, but the transparent part of the image turns black for some reason, here's the simple code: screen = pygame.display.set_mode((800, 600), pygame.DOUBLEBUF, 32) world = pygame.Surface((800, 600),…
Eric
  • 339
  • 2
  • 4
  • 6
23
votes
7 answers

Resize images with PHP, support PNG, JPG

I am using this class: class ImgResizer { function ImgResizer($originalFile = '$newName') { $this -> originalFile = $originalFile; } function resize($newWidth, $targetFile) { if (empty($newWidth) || empty($targetFile)) { return…
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
23
votes
3 answers

png to bmp in C#

is there anyway that I can convert a png to a bmp in C#? I want to download a image then convert it to a bmp then set it as the desktop background. I have the downloading bit and the background bit done. I just need to convert the png to a bmp.
Shuttleu
  • 243
  • 1
  • 2
  • 6
22
votes
9 answers

How do I read JPEG and PNG pixels in C++ on Linux?

I'm doing some image processing, and I'd like to individually read each pixel value in a JPEG and PNG images. In my deployment scenario, it would be awkward for me to use a 3rd party library (as I have restricted access on the target computer), but…
Nick Bolton
  • 38,276
  • 70
  • 174
  • 242
22
votes
5 answers

jpg images in iphone and 2x images

I am working on an iphone app and targeting iOS 4.0 or later. I am trying to add an image to UIImageView, and image is in jpeg format. This is what I have done so far.. UIImageView *bgImageView = [[UIImageView alloc]…
Krishnabhadra
  • 34,169
  • 30
  • 118
  • 167
22
votes
4 answers

Image transcoding (JPEG to PNG) with Java

In my Java application I would like to download a JPEG, transfer it to a PNG and do something with the resulting bytes. I am almost certain I remember a library to do this exists, I cannot remember its name.
adam
  • 22,404
  • 20
  • 87
  • 119
22
votes
11 answers

Read 16-bit PNG image file using Python

I'm trying to read a PNG image file written in 16-bit data type. The data should be converted to a NumPy array. But I have no idea how to read the file in '16-bit'. I tried with PIL and SciPy, but they converted the 16-bit data to 8-bit when they…
Nownuri
  • 689
  • 2
  • 7
  • 19
22
votes
1 answer

Why PNG compression is that much slower than JPEG on Android?

I've been toying with Android Bitmaps a bit and found out, that PNG compression takes much more time than even highest quality JPEG one. Much much more. On my device it can be roughly up to 10 seconds against 1. AFAIK, PNG is basically filtered…
akalenuk
  • 3,815
  • 4
  • 34
  • 56
21
votes
7 answers

Change PNG Color using Javascript/jQuery and CSS

I have a black heart PNG image I want to display with different color. How can I change the color of the heart using javascript/css/jquery? I'm trying to make a shirt designer. So the background is a shirt, and the heart is the print design (among…
haifacarina
  • 1,212
  • 1
  • 12
  • 18
21
votes
7 answers

LaTeX equivalent to Google Chart API

I'm currently looking at different solutions getting 2 dimensional mathematical formulas into webpages. I think that the wikipedia solution (generating png images from LaTeX sourcecode) is good enough until we get support for MathML in…
Jonas
  • 19,422
  • 10
  • 54
  • 67
21
votes
3 answers

What is the difference between using vector drawable and a set of .png for icons in Android?

What are the pros and cons in using vector drawables vs. using a set of .png for Android system icons? If they're meant for two different things, what are those?
Vicky Leong
  • 1,208
  • 3
  • 12
  • 30
21
votes
1 answer

NSImage to NSData as PNG Swift

I am writing a Mac app based on an iOS app. The code below converts a UIImage to NSData to upload to Parse.com. I would like to do the same for Mac but I do not seem to be able to convert it to NSData. What should I be doing? Thanks var image =…
Tom Coomer
  • 6,227
  • 12
  • 45
  • 82