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
6
votes
2 answers

Resize PDF NSImage OSX

I'm updating an image resizing Mac App. What I want to be able to do is if the user imports an image to be resized that has a PDFImageRep, save a new PDF file with a resolution of my choosing. So far I've tried to draw the image at a new size, as…
Mark Bridges
  • 8,228
  • 4
  • 50
  • 65
6
votes
2 answers

Responsive Images: Resize or Dynamically Crop?

This question is actually not about coding but choosing the right method for a task. I don't know if it is against the rules of SO but here you go.. I once built a small CMS for a local newspaper which gave them the functionality of adding their…
6
votes
1 answer

TikZ, resizing and fitting

I want to take a PGF picture, scale it down (scaling the text as well, so \resizebox would be perfect) to obtain a certain height, then put a rotated text on the left of the picture and create a node containing everything. Something like this: But…
dodomorandi
  • 1,143
  • 1
  • 11
  • 18
6
votes
1 answer

Dynamically resize a bufferedimage in java

I tried resizing the buffered image using AffineTransform as well as Scalr.resize Here are my codes for both of them. using Scalr.resize: BufferedImage buff = robot.createScreenCapture(new Rectangle(bufx,bufy,bufwidth,bufheight)); // x-coord,…
6
votes
2 answers

Thumbor // crop and "zoom"

I'm pretty new to thumbor, but i was wondering if, with specific options that I'm unaware of yet, it was possible to "zoom in" an image. Plain example below : So far from what I've understood was possible, it could means to resize to a specific…
Ben
  • 5,030
  • 6
  • 53
  • 94
6
votes
1 answer

Plot won't fit in R window

I am using the meta package in R to do a meta-analysis of proportions. I have about a hundred studies in my analysis. When I type forest(result) to create my forest plot, it works, but the graphic is chopped off at the top and bottom. It won't fit…
Alexander
  • 977
  • 1
  • 13
  • 29
6
votes
2 answers

How to make the code written for image-resizing workable and optimized for all kinds of image extensions?

Basically, I'm using PHP and HTML for my website. I'm a newbie to PHP. So I request you to please correct me if I've made any mistake in my code or approach. I've written code for re-sizing the image uploaded by user to specific size(i.e. specific…
PHPLover
  • 1
  • 51
  • 158
  • 311
6
votes
1 answer

Carrierwave on the fly resize

I'm using carrierwave and I have this problem: Suppose once the project has been delivered you need to add a section where the images in the system need to be displayed with a different size. I don' t want to regenerate the new dimension for each…
6
votes
1 answer

Rotate and crop

I'm rotating and cropping a image with PHP, but I get the black border showing, I know you can change the background color, but I want to rotate and crop the image to fill the whole image. Basically something similar to background-size: cover;…
aNewStart847
  • 1,086
  • 7
  • 15
6
votes
5 answers

image resize zf2

I need to implement image resize functionality (preferably with gd2 library extension) in zend framework 2. I could not find any component/helper for the same. Any references? If i want to create one, where should I add it. In older Zend framework,…
Prashant
  • 5,331
  • 10
  • 44
  • 59
6
votes
1 answer

Changing the sizemode of a background image in picturebox

My aim was to change the background image and set it's SizeMode as Stretch. Tried a lot so far, any ideas? EDIT: I am working in C# forms application. Tried simply setting size mode of bg picture: picturebox1.BackgroundImage =…
5
votes
3 answers

PHP Resize image gives black background

I am using this code for resizing:
DaViDa7
  • 137
  • 1
  • 4
5
votes
5 answers

Change Image Size - PHP

I have recently created an upload function, but I don't know how to change the width and height to 75px... I tried one code I found through Google, but I just got this error: ( ! ) Fatal error: Class 'Imagick' not found in…
ZyteX
  • 239
  • 2
  • 5
  • 13
5
votes
5 answers

Resize JPEG image to fixed width, while keeping aspect ratio as it is

How would you resize a JPEG image, to a fixed width whilst keeping aspect ratio? In a simple way, whilst preserving quality.
cllpse
  • 21,396
  • 37
  • 131
  • 170
5
votes
2 answers

Webkit: live images resize in contenteditable container

I'm trying to have the ability to have resizable images in a contenteditor div in Chrome, like Firefox does. When you click on an image, the resize handlers should appear. I tried the jQuery UI resizable plugin, but it becomes broken when you move…