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
24
votes
8 answers

Serving Images with on-the-fly resize

my company has recently started to get problems with the image handling for our websites. We have several websites (adult entertainment) that display images like dvd covers, snapshots and similar. We have about 100'000 movies and for each movie we…
user253984
22
votes
5 answers

Creating Resizable View that resizes when pinch or drag from corners and sides in FLUTTER

I am currently working on a ScreenView with features like draggable and resizable views with corners and sides like in the image above. The problem I have now is that I want to resize the view by touch gestures in the corners. Therefore, I thought…
jazzbpn
  • 6,441
  • 16
  • 63
  • 99
22
votes
1 answer

Resizing the image with padding using convert on ubuntu

I am using the convert command for resizing the image There are two versions Following is the first one, the resultant image maintains the aspect ratio but the image does not necessarily be of size nxn convert temp.jpg -resize nxn temp.jpg The…
Shan
  • 18,563
  • 39
  • 97
  • 132
22
votes
3 answers

How to resize an image in Java with OpenCV?

After cropping an image how can I resize it? Mat croppedimage = cropImage( image, rect ); Mat resizeimage = croppedimage.resize( any dimension ); //need to change this line
midhun0003
  • 603
  • 1
  • 10
  • 26
21
votes
3 answers

How to specify image size in HTML Doxygen?

I am trying to manually specify the image size in the HTML generated by Doxygen. However, as I read in the documentation, this can only happen if using LaTeX output. Anybody here knows any workaround? As an example, I would like to do something like…
Oriol Nieto
  • 5,409
  • 6
  • 32
  • 38
20
votes
3 answers

How to Cut an Image Vertically into Two Equal Sized Images

So I have an 800 x 600 image that I want to cut vertically into two equally sized pictures using OpenCV 3.1.0. This means that at the end of the cut, I should have two images that are 400 x 600 each and are stored in their own PIL variables. Here's…
Elliot Killick
  • 389
  • 2
  • 4
  • 12
20
votes
6 answers

.Net Core Image Manipulation (Crop & Resize) / File Handling

I have spent the last 5 hours trying to find a feasible way to accomplish what seems to me quite an easy task if it was a previous version of the .NET family that I was working with: Uploading a picture Resizing & Cropping the picture Saving the…
20
votes
1 answer

How to resize and save an image which uploaded using file upload control in c#

i have developed a web application using asp.net mvc4 and razor. in my application there's a file upload control to upload an image and save in a temporary location. before save image should re-sized to a specific size and then save in the temporary…
sanzy
  • 805
  • 9
  • 18
  • 28
19
votes
5 answers

How to get a good quality thumbnail

I am trying to create a high quality thumbnail of this image, with Java and Scalr 3.2 This is the relevant source code, where THUMB_WIDTH = 77 and THUMB_HEIGHT = 57 BufferedImage srcImg = ImageIO.read(new File(sourceFile)); BufferedImage dstImg =…
stivlo
  • 83,644
  • 31
  • 142
  • 199
19
votes
5 answers

Dropzone.js + Client Side Image Resizing

I want to integrate Dropzone.js with a Client Side Image Resizing. I know that there is a function to resize the thumbnail, but I would like to create a function to resize the main image before upload. Anyone could help me please?
Pedro Canelas
  • 301
  • 1
  • 2
  • 4
19
votes
2 answers

bitmap.compress(Bitmap.CompressFormat.PNG, 0, fOut) making image size bigger than original

I want to compress the image taken from a camera to png format to make them smaller in size, so I'm using this code: compressedPictureFile = new File(imagePath); Bitmap bitmap = BitmapFactory.decodeFile(imagePath); FileOutputStream fOut = new…
Dany Y
  • 6,833
  • 6
  • 46
  • 83
18
votes
2 answers

tf.image.resize_bilinear vs cv2.resize

The results from tf.image.resize_bilinear are quite different from cv2.resize. I found this a little bothersome. Set align_corners=True is not always reasonable because the four corners are not always supposed to be fixed in the corner. So is there…
LI Xuhong
  • 2,339
  • 2
  • 17
  • 32
18
votes
1 answer

resize a Matrix after created it in OpenCV

I'm new to OpenCV and I was looking at the Canny tutorial for Edge Detection. I was looking on how to resize a mat just created. The code is this: src = imread( impath ); ... dst.create( src.size(), src.type() ); now I tried to resize the mat…
steo
  • 4,586
  • 2
  • 33
  • 64
17
votes
2 answers

Manipulate an image without deleting its EXIF data

Using imageIO, I usually have the problem of transforming an image file, and after overwriting it, it loses all of its EXIF data. Is there any way to preserve it without first extracting it, caching it, and then resetting it?
Preslav Rachev
  • 3,983
  • 6
  • 39
  • 63
17
votes
4 answers

Why do PDFs resized in SwiftUI getting sharp edges?

I try to include a pdf in my SwiftUI enabled app using Xcode 11.4 and iOS 13.4. However, when I resize the pdf, it gets crips edges. I have included two versions of the pdf: One large pdf (icon.pdf) and one small pdf (icon_small.pdf). When I resize…
Simen
  • 417
  • 6
  • 13