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

resize sdwebImage swift

Hello I am displaying images on my app using sdwebImage. I have a code here to resize the image func resizeImage(image: UIImage, newWidth: CGFloat) -> UIImage { let scale = newWidth / image.size.width let newHeight = image.size.height *…
hellosheikh
  • 2,929
  • 8
  • 49
  • 115
5
votes
5 answers

How to fit whole image in to div which have his dimensions

Original picture size is 876x493, I resize it to:
zhinyz
  • 341
  • 2
  • 10
5
votes
1 answer

Meteor CollectionFS - Image uploading on server

I am using Meteor CollectionFS. Currently my file uploading is performed on client. I want to perform file uploading on server so that other platforms like andriod or ios can use my services of file uploading. Currently here is my…
StormTrooper
  • 1,731
  • 4
  • 23
  • 37
5
votes
1 answer

How to resize, crop and export AVAsset in Swift on OS X?

I'm trying to resize and crop AVAsset and export it to a movie file in Swift on OS X. I am using AVAssetExportSession to export AVAsset and it works without problem if videoComposition is NOT set to the AVAssetExportSession. The following code…
user5563935
5
votes
0 answers

Is there the better way to resize the Buffered image without losing of quality?

To resize the Buffered Image I have the following method: BufferedImage resizeImage(BufferedImage img, int newW, int newH) { Image tmp = img.getScaledInstance(newW, newH, Image.SCALE_SMOOTH); BufferedImage dimg = new…
Dylan
  • 935
  • 1
  • 11
  • 24
5
votes
1 answer

PHP - Place an image over another image

I want to place an image over another image using php. I have two images. One is a photo. And other one is a image, of fixed size, full white. We can call this as frame. So what i need is place the photo in the middle of the frame (white image) and…
Gijo Varghese
  • 11,264
  • 22
  • 73
  • 122
5
votes
4 answers

PHP - Create Thumbnail & maintaining aspect ratio

EDIT: This can be easily done in CSS, I didn't know CSS much at the time of writing this I have created a thumbnail creator using PHP. The thumbnails generated should be of the same size. But the problem is the use of uploads images having…
Gijo Varghese
  • 11,264
  • 22
  • 73
  • 122
5
votes
2 answers

what is the difference between opencv's and matlab's bicubic algorithm?

When using opencv's resize img = cv2.imread('fname.png', 0 ) res = cv2.resize(img,None,fx=2, fy=2, interpolation = cv2.INTER_CUBIC) cv2.imwrite('scaled_cv2.png',res) and matlab's imresize I = imread('fname.png'); J = imresize(I,2, 'Antialiasing',…
dodol
  • 1,073
  • 2
  • 16
  • 33
5
votes
1 answer

Restrict Image size (<1MB) upon HTML5 canvas resize

I have a HTML5 uploader for images. I upload two images for any image that the user selected. One is 64x64 and the other is 320x240. I am using canvas.drawImage() to resize the images. Everything is working fine. However,How can i ensure that the…
Mayur Buragohain
  • 1,566
  • 1
  • 22
  • 42
5
votes
3 answers

android ImageButton do not stretch image

How can I prevent the ImageButton from stretching the image? Using this snippet:
Klaus Nji
  • 18,107
  • 29
  • 105
  • 185
5
votes
2 answers

How to get multiple images to auto resize and stay centered within a div

I am trying to get the multiple university logo images in a row to scale down as the browser width gets smaller and not overflow its container div, just like I do with the blueish picture above. The picture scales within its div by applying max…
Nearpoint
  • 7,202
  • 13
  • 46
  • 74
5
votes
3 answers

Android Development - Resizing images into drawable folders

Is there a way to get Eclipse to automatically re-size images and put them in the appropriate drawable folders? When you add an image for the icon when you first create an Android project, it automatically re-sizes the icon and puts them in the…
Michael
  • 199
  • 1
  • 9
5
votes
0 answers

ImageMagick -monitor command for animated gif resizing

Using ubuntu: convert /home/cms/img2.gif -monitor -resize 150x /home/cms/result.gif I'm using ImageMagick for resizing/cropping purposes and want to create progress bar for resizing procedure. Everything is ok for jpeg images, but when i'm trying…
Somebody
  • 9,316
  • 26
  • 94
  • 142
5
votes
1 answer

C# Resize jpg image, convert to byte and save into database using varbinary

I'm trying to resize my jpg image uploaded by using FileUpload control and convert it into byte before saving it to database (SQL Server 2008) as (varbinary(MAX)). What I have done and code show below was that I manage to convert it into byte and…
XiAnG
  • 245
  • 2
  • 9
  • 25
5
votes
3 answers

How to rotate and resize the image view with single finger

I am developing an app which has feature that resizing and rotating the imageview by dragging its bottom right corner button. I saw one app which has feature that if we drag the bottom right corner button diagonally imageview size had resized or…
thavasidurai
  • 1,972
  • 1
  • 26
  • 51