Questions tagged [jpeg]

JPEG is a common lossy compression method for digital images. Use this tag for questions about JPEG images using the image/jpeg MIME type.

JPEG is a common lossy compression method for digital images. Use this tag for questions about JPEG images using the image/jpeg MIME type.

See also , , and for other image file formats with JPEG in the name.

More information at the JPEG Wikipedia page.

4926 questions
84
votes
9 answers

Efficient JPEG Image Resizing in PHP

What's the most efficient way to resize large images in PHP? I'm currently using the GD function imagecopyresampled to take high resolution images, and cleanly resize them down to a size for web viewing (roughly 700 pixels wide by 700 pixels…
maxsilver
  • 4,524
  • 4
  • 28
  • 24
78
votes
5 answers

PIL cannot write mode F to jpeg

I am taking a jpg image and using numpy's fft2 to create/save a new image. However it throws this error "IOError: cannot write mode F as JPEG" Is there an issue with CMYK and JPEG files in PIL??? p = Image.open('kibera.jpg') bw_p =…
JHHP
  • 781
  • 1
  • 5
  • 4
78
votes
4 answers

How to execute ImageMagick to convert only the first page of the multipage PDF to JPEG?

How do I execute ImageMagick's convert if I want a JPEG from the first page only of a multi-page PDF?
V A S
  • 3,338
  • 4
  • 33
  • 39
69
votes
5 answers

Problem reading JPEG Metadata (Orientation)

I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect. I'm working on an ASP.NET MVC 3 web application where i need to upload photos (currently using…
RPM1984
  • 72,246
  • 58
  • 225
  • 350
68
votes
4 answers

How to convert a PDF into JPG with command line in Linux?

What are fast and reliable ways for converting a PDF into a (single) JPEG using the command line on Linux?
Soerendip
  • 7,684
  • 15
  • 61
  • 128
68
votes
6 answers

webdesign - jpg or png, which one is the best for web

I've been a web developer for quite some time, and I am used to transforming all my designs into the png file format in order to build my webpages. Despite the fact that png, contrary to jpg, allows transparency in the images, is it a better…
yoda
  • 10,834
  • 19
  • 64
  • 92
66
votes
4 answers

Only PNG supports transparency, is that true?

I found JPG does not support transparency, the alpha value is always 255. I am wondering only png supports transparency?
Adam Lee
  • 24,710
  • 51
  • 156
  • 236
63
votes
3 answers

Converting a byte array to PNG/JPG

I am currently working on an application that requires high-performance conversion of an unpadded byte array to either a PNG or JPEG. The image format doesn't matter, just as long as it's fast. I have tried the .NET libraries and the performance is…
user472875
  • 3,115
  • 4
  • 37
  • 68
63
votes
2 answers

Why should I use PNG and not JPG?

I'm building an app that uses a lot of images, so it's getting pretty big. I got more than 15mb in PNG images, and if I convert those images to JPG I would get 5MB or less! So, why should I use PNG instead of JPG? I know that PNGs are preferred, but…
Victor Santiago
  • 902
  • 1
  • 10
  • 20
63
votes
8 answers

Use PHP to convert PNG to JPG with compression?

I have a bunch of high quality PNG files. I want to use PHP to convert them to JPG because of it's smaller file sizes while maintaining quality. I want to display the JPG files on the web. Does PHP have functions/libraries to do this? Is the…
John
  • 32,403
  • 80
  • 251
  • 422
62
votes
6 answers

ImageIO not able to write a JPEG file

I have a BufferedImage I'm trying to write to a jpeg file, but my Java program throws an exception. I'm able to successfully save the same buffer to a gif and png. I've tried looking around on Google for solutions, but to no avail. Code: File…
Karan
  • 1,636
  • 4
  • 19
  • 35
62
votes
4 answers

C# Base64 String to JPEG Image

I am trying to convert a Base64String to an image which needs to be saved locally. At the moment, my code is able to save the image but when I open the saved image, it says "Invalid Image". Code: try { using (var imageFile = new…
Subby
  • 5,370
  • 15
  • 70
  • 125
60
votes
4 answers

In OpenCV (Python), why am I getting 3 channel images from a grayscale image?

I am using Python (2.7) and bindings for OpenCV 2.4.6 on Ubuntu 12.04 I load an image image = cv2.imread('image.jpg') I then check the shape of the image array print image.shape I get (480, 640, 3), which I expect for a 640x480 colour…
Steve
  • 2,764
  • 4
  • 27
  • 32
60
votes
5 answers

Setting jpg compression level with ImageIO in Java

I'm using javax.imageio.ImageIO to save a BufferedImage as a jpeg file. In particular, I created the following Java function: public static void getScreenShot(BufferedImage capture, Path folder, String filename) { try { …
mat_boy
  • 12,998
  • 22
  • 72
  • 116
60
votes
3 answers

ImageMagick PDF to JPGs sometimes results in black background

I have the following: ghostscript-fonts-5.50-24 ImageMagick-6.7.2-1 ghostscript-9.02-1 Which I use to create a series of JPGs for each page using: convert -density 175 -colorspace sRGB test.pdf -resize 50% -quality 95 test.jpg When I run this on…
jahilldev
  • 3,520
  • 4
  • 35
  • 52