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
1 answer

Resize SMALLEST image dimension

This seems like something that would've been asked before but I can't find the duplicate so... I want the smallest dimension of an image to be scaled max 200 while keeping aspect ratio. So: A 600x400 image has smallest dimension 400, which should…
Mark
  • 18,730
  • 7
  • 107
  • 130
7
votes
2 answers

detect screen density using javascript on mobile devices?

I was wondering if it is possible to detect the screen density from a web page by using javascript and/or some sort of server checking based on http headers on PHP. My goal is to check if the user is accessing the site from a tablet, phone or…
chokito76
  • 93
  • 2
  • 5
7
votes
2 answers

Resize image in WPF

i have a image and i want to re size it and need to save in my temp folder. what i have tried is as below : UIElement uie = CanvasHost.Child; int width = 800; int height = (int)((width / (double)((FrameworkElement)uie).Width) *…
DevT
  • 4,843
  • 16
  • 59
  • 92
7
votes
3 answers

How can I resize a picture before displaying it in a view with Android Universal Image Loader?

I successfully applied the Universal Image Loader library (1.8.3 version) to my app, and I'm trying to resize the image before displaying it in the gridview item (because sometime image is too big to cache it in memory.) Here is what I am…
John F
  • 685
  • 1
  • 8
  • 18
7
votes
3 answers

TinyMCE prevent image resizing

I am adding an image to a TinyMCE editor using: var params = { src: filename, title: "Attached image: " + filename, width: 500 }; ed.execCommand("mceInsertContent", false, ed.dom.createHTML("img",…
nico
  • 50,859
  • 17
  • 87
  • 112
7
votes
5 answers

Resizing images (jpeg or decompressed image)

In my last question I asked whether there was a better way to rotate images than I had thought of. I ended up discovering jpegtran and have since found libjpeg-turbo. Now I am looking for a better way to resize the images (jpegs) than imagemagick…
Thomaschaaf
  • 17,847
  • 32
  • 94
  • 128
6
votes
3 answers

How to scale an image to full screen using JavaScript?

I have an image that I would like to scale to full screen. How would I do this using JavaScript/jQuery? No animation is necessary, just resizing the image.
Andrew
  • 227,796
  • 193
  • 515
  • 708
6
votes
1 answer

Remove the image resize ratio in OpenCart

I've look everywhere on how I could remove the image resizing in OpenCart but haven't find nothing about that. I need that it resize but don't keep the ratio. I want the image to be just like I set it. Here's the resize code in the…
Warface
  • 5,029
  • 9
  • 56
  • 82
6
votes
1 answer

How to resize base64 encoded image in python

I want resize base64 encoded image in python.I searched I could not find. I used Pillow package to do it. However, Pillow has no such kind of feature .
6
votes
2 answers

CKEditor 5 image resize in Angular

I install CKEditor5 in Angular project, it works fine but i have a problem with resize image. I see the documentation in this link: https://ckeditor.com/docs/ckeditor5/latest/features/image.html#installation but i'm not able to implement it…
Drilon Hametaj
  • 140
  • 1
  • 8
6
votes
2 answers

How to resize a tiff image with multiple channels?

I have a tiff image of size 21 X 513 X 513 where (513, 513) is the height and width of the image containing 21 channels. How can I resize this image to 21 X 500 X 375? I am trying to use PILLOW to do so. But can't figure out if I am doing something…
6
votes
1 answer

Draw auto-resized image in PDF file with PDFBox

My aim is it to draw an uploaded image of which I do not know the dimensions on a PDF file with one empty page (DIN A4). For horizontal images I have a PDF file with one horizontal empty page and for vertical images I have a PDF file with one…
Lea
  • 261
  • 5
  • 14
6
votes
1 answer

Nearest neighbor image resizing wrong using scipy and PIL

I'm trying to take a small image and make a large ("pixelated") version of it using Python. I've tried using the nearest neighbor resizing methods in both scipy and PIL.Image and both output the same wrong result. Here's an example when trying to…
dorverbin
  • 467
  • 1
  • 4
  • 17
6
votes
4 answers

Stretching bubble image in Chat app

I am creating a chat app. I have to stretch the bubble image according to the text like other chatapps. I am using AutoLayout constraints. Size of imageview containing bubble increaser perfectly. (I have given yello background color to it). The…
SNarula
  • 548
  • 3
  • 16
6
votes
2 answers

FabricJS Setting background image size and position

I'm using FabricJS for a project in which I need to be able to set the background image of the canvas. The canvas can be any size and can be resized at any time. Lastly, the image should always fill the canvas regardless of its size, but never be…
Daniel Bonnell
  • 4,817
  • 9
  • 48
  • 88