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

Is there a way automatically to resize MediaWiki images depending on screen size?

MediaWiki pictures can be set to a certain size with simple formatting. However, tables will resize on the fly depending on the browser / screen size. Can images be made to resize like tables? (Images inside tables does not work!)
7
votes
3 answers

Bilinear interpolation to enlarge bitmap images

I'm a student, and I've been tasked to optimize bilinear interpolation of images by invoking parallelism from CUDA. The image is given as a 24-bit .bmp format. I already have a reader for the .bmp and have stored the pixels in an array. Now I need…
f0rfun
  • 716
  • 4
  • 14
  • 36
7
votes
2 answers

PHP image resize function doesn't work properly

I want to resize an image PNG with transparence plz help. Here is the code : function createThumb($upfile, $dstfile, $max_width, $max_height){ $size = getimagesize($upfile); $width = $size[0]; $height = $size[1]; $x_ratio = $max_width /…
Rjaibi Mejdi
  • 6,820
  • 3
  • 21
  • 26
7
votes
3 answers

How to resize SVG with PHP?

I am trying to resize (increase size) a SVG inside a PHP script and save it as a new SVG. Given SVG is generated by another script. It contains image and texts. I have tried with imagick, but the generated svg is broken, and doesn't include any of…
тнє Sufi
  • 574
  • 2
  • 9
  • 23
7
votes
1 answer

Resizing a image with Javascript without rendering a canvas on the DOM

I've seen this interesting thread among many others: Resize a Base-64 image in JavaScript without using canvas However when i create an off screen canvas using const canvas = document.createElement('canvas'); the result image is transparent and the…
Benekiki
  • 101
  • 1
  • 7
7
votes
4 answers

Bitmap scale destroy quality

I have made a Watch Face for Android Wear. But the problem is image scaling. Images for background, markers and gadgets are of reduced quality when I resize them. For example, I put 480x480 background image in drawable-nodpi folder (I have tried…
filipst
  • 1,547
  • 1
  • 30
  • 55
7
votes
1 answer

Jimp read, resize and display image from url

I can now get some data of picture from url, when I do something like this: Jimp.read("https://someurl/04fc0d67a91bbd3b7e07.jpeg", function (err, image) { console.log(image.bitmap.data) res.end(image.bitmap.data) }); I get…
Vladimir
  • 1,751
  • 6
  • 30
  • 52
7
votes
3 answers

How to reduce image size into 1MB

I want my application to upload image with no size limit, but in the code, I want to resize the image into 1MB if the image size exceeds. I have tried many ways but I couldn't find any code for the requirement I have mentioned above. For once, I…
Aysha Ashraf
  • 67
  • 1
  • 1
  • 3
7
votes
1 answer

Resize a batch of images in numpy

I have close to 10000 greyscale images in a numpy array (10000 x 480 x 752) and would like to resize them with the imresize function from scipy.misc. It works with a for loop build around all the images, but it takes 15 minutes. images_resized =…
Peter Lenaers
  • 419
  • 3
  • 8
  • 17
7
votes
1 answer

Resize and Save Image While Preserving Metadata

I am attempting to resize and save an image, which is fairly easy (for instance, see this example external example no longer valid). However, using this code strips the metadata information from the image. I can't quite seem to figure out how to…
Wonko the Sane
  • 10,623
  • 8
  • 67
  • 92
7
votes
2 answers

Resizing images on the fly, or storing different sizes on disk?

I'm building a Web application that will eventually contain a lot of images. These images will need to be displayed in different formats across the site. What would be the pros/cons of the two solutions: Storing various versions of the picture when…
Yngve B-Nilsen
  • 9,606
  • 2
  • 36
  • 50
7
votes
2 answers

Laravel Image Intervention resize quality loss

In my Laravel web-application I make use of the Intervention Image library. I'm saving three versions of the uploaded image: 'original', '500_auto' and a custom size image. $image = Image::make(Input::file('file'); // Save the orignal…
kipzes
  • 694
  • 2
  • 10
  • 27
7
votes
1 answer

ImageMagick resize by percentage and limit

I'm trying to resize various images using ImageMagick. I have a requirement for this to be done in a single command without any supporting extra language. I want to resize all images below a certain width to 115% (or the equivalent: resize all…
cyterdan
  • 103
  • 1
  • 8
7
votes
2 answers

Serve an image at different size / resolution depending on device width and users bandwidth

Im building a website with a full screen background, the site is responsive and currently serves the same images to an iphone as it would do to a 27" monitor. Obviously the 27" monitor needs a higher res image, currently all devices / screen…
sam
  • 9,486
  • 36
  • 109
  • 160
7
votes
2 answers

C# Crop & resize large images

I got some very large building drawings, sometimes 22466x3999 with a bit depth of 24, or even larger. I need to be able to resize these to smaller versions, and to be able to cut out sections of the image to smaller images. I have been using the…
Martin M
  • 463
  • 8
  • 20