in a program like this, it makes NO difference
whether i save as PNG or GIF ?
(is one smaller than the other?)
black= (0,0,0)
white= (255,255,255) .............
from PIL import Image
from PIL import ImageDraw
def newImg():
img = Image.new('RGB', (120, 120))
for i in range(100):
img.putpixel((10+i,10+i), (red, black, white)[i%3])
img.save('test.gif')
return img
In general a 'PNG' image has better quality than 'GIF'. In a 'PNG' image all the pixels that the program generated are still present, exactly as they were generated. In a 'GIF' image, however, pixels may have been altered in order to accommodate a smaller file size.
On 3/07/24 11:22 pm, Pieter van Oostrum wrote:
In general a 'PNG' image has better quality than 'GIF'. In a 'PNG'
image all the pixels that the program generated are still present,
exactly as they were generated. In a 'GIF' image, however, pixels may
have been altered in order to accommodate a smaller file size.
I think you're thinking of JPEG. PNG and GIF both use lossless
compression, however GIF only supports 8-bit colour and 1-bit
transparency. For images with no more than 256 distinct colours, PNG and
GIF will probably give identical results.
thank you...˙ so it seems the GIF file is smaller but
˙˙˙˙˙˙˙˙˙˙˙˙˙ can show fewer˙ colors.
On 3/07/24 11:22 pm, Pieter van Oostrum wrote:
In general a 'PNG' image has better quality than 'GIF'. In a 'PNG'
image all the pixels that the program generated are still present,
exactly as they were generated. In a 'GIF' image, however, pixels may
have been altered in order to accommodate a smaller file size.
I think you're thinking of JPEG. PNG and GIF both use lossless
compression, however GIF only supports 8-bit colour and 1-bit
transparency. For images with no more than 256 distinct colours, PNG and
GIF will probably give identical results.
Sysop: | Tetrazocine |
---|---|
Location: | Melbourne, VIC, Australia |
Users: | 4 |
Nodes: | 8 (0 / 8) |
Uptime: | 215:12:08 |
Calls: | 73 |
Calls today: | 1 |
Files: | 21,500 |
Messages: | 73,913 |