Questions tagged [image-resizing]

Image resizing is the downscaling or upscaling of an image. Dozens of algorithms exist, all with performance vs. quality tradeoffs.

Image resizing (also called image scaling) is the downsampling or up-sampling of an image using an interpolation algorithm. Common downscaling algorithms are Lanczos, Bicubic Sharper, Bicubic Smoother, Fant, Bicubic, Bilinear, and NearestNeighbor (listed in order of average result quality). Fractal algorithms often produce better results for upscaling photos, while there are many algorithms optimized for upscaling pixel art.

Due to algorithmic complexity, most developers use library implementations of these algorithms.

FreeImage

Offers CatmullRom, Lanczos3, bspline, box, bicubic, and bilinear filters. FreeImage focuses on implementation simplicity, and doesn't use hardware accelerations or SIMD extensions, so these speeds may not be acceptable for real-time display of images.

Windows GDI+

While loathed by many, GDI+ does include an excellent 2-pass Bicubic filter. It offers: 2-pass Bicubic, 1-pass bicubic, bilinear, and nearest neighbor. Those using it should be aware that it may add rings to images unless WrapMode is set to TileXY, as otherwise the algorithm samples data from outside the image bounds.

WIC (Windows Imaging Components)

The IWICBitmapScaler class offers Fant, 1-pass bicubic, bilinear, and nearest neighbor. Implementations are optimized for performance, and can be 2-4x faster than their GDI counterparts, although there isn't currently a 2-pass bicubic filter such as offered by GDI+

2188 questions
5
votes
4 answers

Premature end of JPEG file

I am getting this Premature end of JPEG file error while resizing some of the images. Interesting and strange part is that i am getting this error only when i upload any camera taken images, like from mobile, other than those every thing works…
hashmi
  • 651
  • 2
  • 9
  • 24
5
votes
1 answer

Alternatives to ImageMagick for resizing

I am having some serious trouble installing ImageMagick and RMagick on my Windows 7 computer. I was just wondering if there were any other easier to setup alternatives that work with Ruby on Rails and allow image re-sizing and cropping?
5
votes
1 answer

Different images loaded for different web screen sizes

I have this code which loads automatically a different picture from an array everytime a user loads index.html. This is the jquery code: $(window).load(function() { var randomImages = ['img1','img2','img3','img4','img5']; var rndNum =…
5
votes
3 answers

Resizing images on the server

We just implemented a feature where our users can upload photos. We are re-sizing what the user has uploaded into thumbnail and an 800x600 "display" size. The problem we are having is that this operation seems to be taking up a lot of memory on our…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
5
votes
3 answers

Can I change the resolution of a jpg image in Java?

I have some .jpg's that I'm displaying in a panel. Unfortunately they're all about 1500x1125 pixels, which is way too big for what I'm going for. Is there a programmatic way to change the resolution of these .jpg's?
Quintis555
  • 659
  • 3
  • 11
  • 16
5
votes
2 answers

PHP imagecreatefromjpeg works, so why doesn't png/bmp/gif work?

I want to upload and resize pictures with different extensions. The php crops the biggest possible square from the center of the original pic, then saves it in 360*360 pixels. The code works fine with jpeg files, but with gif, bmp and png I get a…
ezattilabatyi
  • 357
  • 1
  • 2
  • 11
4
votes
3 answers

Converting image into stream

I'm using a function that uploads an image, takes the stream and resizes it using imageresizer.net, then uploads the stream to Amazon S3. Now I want to take a local picture and convert it into a stream. (to resize and upload to amazonS3). Basically,…
monsey11
  • 243
  • 4
  • 18
4
votes
1 answer

resize multiple images in php without exceeding memory limit

I am currently trying to get a form which will allow multiple images to be uploaded and resized on the server using PHP. Each uploaded image by the client is around 2.5mb in size. I am currently using the move_uploaded_file() function. There are no…
tdh87
  • 585
  • 1
  • 4
  • 8
4
votes
3 answers

Symfony2 : Resizing uploaded images

Is there any way to resize pictures while uploading them in Symfony2 ? The ImagineAvalancheBundle only allows to resize images to thumbnails when retrieving them, which is not really performant to me. Besides, the UploadedFile object retreived when…
Yoot
  • 657
  • 2
  • 14
  • 26
4
votes
2 answers

OpenCV error: (-215:Assertion failed) inv_scale_x > 0 in function 'cv::resize'

import numpy as np import cv2 img = cv2.imread(r"C:\Users\User\Documents\sypder\try\bird.jpg", cv2.IMREAD_UNCHANGED) print('Original Dimension:',img.shape) scale_percentage = 30 width = int(img.shape[0] * scale_percentage/100) height =…
lala
  • 47
  • 1
  • 2
4
votes
6 answers

Resize all images stored in Firebase Storage

I have uploaded around 10k high-resolution images on Firebase Storage Bucket. As of now due high bandwidth I need to scale down those images from the bucket without deleting the original image. Firebase image resizes extensions function solves this…
4
votes
1 answer

Dynamically resize image using firebase resize images extension

In our Firebase storage, we have images that have widths of 1080 and varying heights. Using this extension (https://firebase.google.com/products/extensions/storage-resize-images), we need to resize the width to 480, maintaining the aspect ratio. How…
4
votes
0 answers

Different result OpenCv between Python and Android

I am trying to use a Pytorch model on Android and to do so, I am using OpenCv to do the pre processing. My pre processing is composed of 3 steps: - greyscaling - resizing - normalize images [-1,1] (not with OpenCv) However when I do the resizing on…
Thomas
  • 354
  • 1
  • 3
  • 13
4
votes
1 answer

Does PIL img.resize larger and then smaller return the same image?

I'm not sure exactly how the algorithm works. In the general case, I'm wondering if I resize an image to a larger size and then resize it down back to the original size, will the image be the same as the original?
StarckOverflar
  • 1,577
  • 2
  • 10
  • 13
4
votes
1 answer

How to resize a Texture2D using height and width?

i tried to resize the texture with size and width and its showing index out of width/height the texture need to be resized because i'm using it on other texture to apply on particular co-ordinates so i'm not able to resize the texture graphics is my…