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+

2028 questions
693
votes
18 answers

Resize image proportionally with CSS?

Is there a way to resize (scale down) images proportionally using ONLY CSS? I'm doing the JavaScript way, but just trying to see if this is possible with CSS.
codingbear
  • 13,753
  • 20
  • 44
  • 64
319
votes
19 answers

Resizing an image in an HTML5 canvas

I'm trying to create a thumbnail image on the client side using javascript and a canvas element, but when I shrink the image down, it looks terrible. It looks as if it was downsized in photoshop with the resampling set to 'Nearest Neighbor' instead…
Telanor
  • 4,179
  • 6
  • 25
  • 34
206
votes
19 answers

Responsive css background images

I have a website (g-floors.eu) and I want to make the background (in css I have defined a bg-image for the content) also responsive. Unfortunately I really don't have any idea on how to do this except for one thing that I can think of but it's quite…
jochemke
  • 2,237
  • 3
  • 13
  • 10
165
votes
2 answers

Resize image to full width and fixed height with Picasso

I have a vertical LinearLayout where one of the items is an ImageView loaded using Picasso. I need to rise the image's width to the full device width, and to display the center part of the image cropped by a fixed height (150dp). I currently have…
David Rabinowitz
  • 28,033
  • 14
  • 88
  • 124
157
votes
7 answers

Resize Google Maps marker icon image

When I load an image into the icon property of a marker it displays with its original size, which is a lot bigger than it should be. I want to resize to the standard to a smaller size. What is the best way to do this? Code: function…
103
votes
13 answers

Resize image in PHP

I'm wanting to write some PHP code which automatically resizes any image uploaded via a form to 147x147px, but I have no idea how to go about it (I'm a relative PHP novice). So far, I've got images uploading successfully, filetypes being recognised…
Alex Ryans
  • 1,663
  • 5
  • 21
  • 31
100
votes
15 answers

EC2 Can't resize volume after increasing size

I have followed the steps for resizing an EC2 volume Stopped the instance Took a snapshot of the current volume Created a new volume out of the previous snapshot with a bigger size in the same region Deattached the old volume from the…
Wilman Arambillete
  • 1,231
  • 2
  • 9
  • 12
88
votes
12 answers

Node.js: image resizing without ImageMagick

I'm developing a web app on Node.js (+ express 4) where users can set their profile image by uploading it to the server. We already limit the file mimetype and max filesize, so the user can't upload more than 200KB png or jpeg images. The problem is…
zacr0
  • 991
  • 1
  • 7
  • 9
87
votes
1 answer

Changing image size in Markdown on Gitlab

I'm trying to post a picture to a file on my Gitlab using markdown ![](test/media/screenshot.png) seems to work but is far too large. Other solutions I've tried and don't seem to work are as follows:
Ben Kelly
  • 871
  • 1
  • 5
  • 4
87
votes
6 answers

How to set max width of an image in CSS

On my website I would like to display images uploaded by user in a new window with a specific size (width: 600px). The problem is that the images may be big. So if they are bigger than these 600px, I would like to resize them, preserving the aspect…
user1315305
  • 1,119
  • 1
  • 9
  • 20
73
votes
4 answers

Batch resize images and output images to new folder with ImageMagick

Current image folder path: public_html/images/thumbs Output image folder path: public_html/images/new-thumbs I have 10 video thumbs per video in current folder, named of image thumbs: 1-1.jpg 1-2.jpg 1-3.jpg 1-4.jpg 1-5.jpg…
richard
  • 1,156
  • 2
  • 13
  • 22
59
votes
3 answers

Android - Reduce image file size

I have an URI image file, and I want to reduce its size to upload it. Initial image file size depends from mobile to mobile (can be 2MB as can be 500KB), but I want final size to be about 200KB, so that I can upload it. From what I read, I have (at…
KitKat
  • 705
  • 2
  • 7
  • 10
41
votes
1 answer

Kinetic js drag, drop, resize and rotate image

I am trying to combine drag and drop resize image and rotating image on touch, and mine is behaving strange http://jsfiddle.net/littlechad/Kuaxn/ My code is as follows: function update (activeAnchor) { var group =…
littlechad
  • 1,152
  • 13
  • 44
38
votes
11 answers

Is there a way to load image as bitmap to Glide

Im looking for a way to use bitmap as input to Glide. I am even not sure if its possible. It's for resizing purposes. Glide has a good image enhancement with scale. The problem is that I have resources as bitmap already loaded to memory. The only…
Maher Abuthraa
  • 15,704
  • 9
  • 68
  • 97
36
votes
10 answers

How can I read (from disk) and resize an image, in Flutter/Dart

In Flutter/Dart, how can I perform the following 3 steps: Read an image from disk, Read its original dimensions (width and height), Resize it. Note: I must be able to display the final result with a regular Flutter Image widget. CLARIFICATION:…
MarcG
  • 21,878
  • 14
  • 83
  • 95
1
2 3
99 100