Batch resize images into new folder using ImageMagick

convert is designed to handle a single input file as far as I can tell, although I have to admit I don’t understand the output you’re getting. mogrify is better suited for batch processing in the following style: mogrify -path ../dsc_small -define jpeg:extent=2MB dsc_big/* But honestly I consider it dangerous for general usage (it’ll overwrite … Read more

Transparent Background Image with a Gradient

Keep in mind that a CSS gradient is actually an image value, not a color value as some might expect. Therefore, it corresponds to background-image specifically, and not background-color, or the entire background shorthand. Essentially, what you’re really trying to do is layering two background images: a bitmap image over a gradient. To do this, … Read more

How to batch resize images in Ubuntu recursively within the terminal?

You could use imagemagick. For instance, for resizing all the JPG images under the current directory to 50% of their original size, you could do: for f in `find . -name “*.jpg”` do convert $f -resize 50% $f.resized.jpg done The resulting files will have “.jpg” twice in their names. If that is an issue, you … Read more

Display image in Qt to fit label size

Actually there is a very simple solution for this problem. There are two things you should modify: Set the scaled content to true (mentioned above) Set the label’s size policy to ignored QLabel lblImage; lblImage->setPixmap( QPixmap( “big_image.jpg” ) ); lblImage->setScaledContents( true ); lblImage->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); If the lblImage is resizing automatically, the image will … Read more