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
13
votes
3 answers

Bilinear upsample in tensorflow?

I want to do a simple bilinear resize (not necessarily by an integer factor) in TensorFlow. For example, starting from a (32,3,64,64) tensor, I would like a (32,3,96,96) tensor, where each 64x64 has been rescaled by a factor of 1.5 using bilinear…
Alex I
  • 19,689
  • 9
  • 86
  • 158
13
votes
1 answer

When using node sharp package to resize image and upload to s3 it is rotated

I am using this node package: https://www.npmjs.com/package/sharp I use it to resize an image and then upload it to amazon S3. Most images are find but some of them (I assume based on aspect ratio) get rotated. Is there a way to prevent this or a…
jaget
  • 2,149
  • 6
  • 21
  • 29
13
votes
1 answer

Qt resize image with best quality

Can anyone help me resize an image in qt without making the image pixelated. Here's my code. the result is not as good as the original quality..thanks... QImage img(name); QPixmap pixmap; pixmap =…
James Seva
  • 139
  • 1
  • 2
  • 7
13
votes
3 answers

Can I use a URL as the source for imagecreatefromjpeg() without enabling fopen wrappers?

I know it’s possible to use imagecreatefromjpeg(), imagecreatefrompng(), etc. with a URL as the ‘filename’ with fopen(), but I'm unable to enable the wrappers due to security issues. Is there a way to pass a URL to imagecreatefromX() without…
iRector
  • 1,935
  • 4
  • 22
  • 30
13
votes
2 answers

Reducing PDF file size using Ghostscript on Linux didn't work

I have about 50-60 pdf files (images) that are 1.5MB large each. Now I don't want to have such large pdf files in my thesis as that would make downloading, reading and printing a pain in the rear. So I tried using ghostscript to do the following: gs…
dearN
  • 1,256
  • 4
  • 19
  • 40
12
votes
3 answers

Which free image resizing library can I use for resizing and probably serving images?

I have used Umbraco and there is very nice ImageGen library there which allows to resize images 'on the fly' and cashes processed images. Is there something similar to it I can use outside Umbraco? (I thought I could use ImageGen without Umbraco but…
Burjua
  • 12,506
  • 27
  • 80
  • 111
12
votes
4 answers

ReactJS: Resize image before upload

In my reactJs project, I need to resize image before uploading it. I am using react-image-file-resizer library which has a simple example but not working for me. I have tried this but its shows me blank result. What am I doing wrong? var imageURI…
newdeveloper
  • 1,401
  • 3
  • 17
  • 43
12
votes
1 answer

Resizing image with nodeJs and AWS

I am attempting to get an image from a AWS S3 bucket using nodejs, resizing it into 4 different sizes and then saving it back to the same bucket but into a folder which in turn contains 4 folders, each for the new sizes. When I run the function, I…
hyprstack
  • 4,043
  • 6
  • 46
  • 89
11
votes
4 answers

Resizing UImage when using SF Symbols - UIImage(systemName:)

I have the following pre-packaged, system SF image: UIImage(systemName: "location.fill") It may seem trivial, but how can I resize it to make it bigger? Thank you.
11
votes
2 answers

How do I fill white background while resize image

Current background is black. How to change the color to be white? #assuming the mime type is correct switch ($imgtype) { case 'image/jpeg': $source = imagecreatefromjpeg($source_image); break; case…
Blur
  • 1,216
  • 3
  • 12
  • 17
11
votes
4 answers

View large multi page Tif images within 100 milliseconds

I'm using WinForms. Inside my form I have a pictureBox (set to normal mode), next and previous button. I want to resize and load Multipage TIF images quickly. When I go to the next page in the Multipage TIF image I experience a delay every time the…
taji01
  • 2,527
  • 8
  • 36
  • 80
11
votes
2 answers

gulp-image-resize to generate multiple output sizes

I'd like to use gulp to generate a bunch of different image sizes and optimize them at the same time. I think there are two approaches to this problem: The first is that you could create n different tasks for each size, then create a master task…
septagram
  • 445
  • 2
  • 7
  • 14
11
votes
1 answer

openCV equivalent of a PIL resize ANTIALIAS?

In PIL the highest quality resize from what I've seen seems to be: img = img.resize((n1, n2), Image.ANTIALIAS) For openCV this seems to be the way to do it: small = cv2.resize(image, (0,0), fx=0.5, fy=0.5) So my question is, is there an…
alfredox
  • 4,082
  • 6
  • 21
  • 29
10
votes
2 answers

carrierwave + mini_magick gems = not an image error

I'm using: - carrierwave 0.6.0 - rails 3.2.1 - mini_magick 3.4 - ruby 1.9.2p290 And during image uploading I want to resize uploading pic: (image_uploader.rb) process :resize_to_fit => [200, 200] But after image uploading I've got an error: 1…
lukaszkups
  • 5,790
  • 9
  • 47
  • 85
10
votes
4 answers

How to resize source with sorl-thumbnail?

I was searching the web for my question and couldn't find a clear answeror any example. Basically, I want to use sorl and want to resize the source image during the Model save time to resize it down to 640x480 size, so that I don't end-up storing…
user1039384
  • 521
  • 7
  • 16