fit multiple images on background image using imagemagick - background

I am trying to use image magic to do the following:
I have pdf with multiple pages, I want to convert them into JPG.
I have a background image with fixed width and height which will work as a container.
I want to place each of the converted JPGs alone on the background image and fit it on the background image with stretching and keeping the image proportion, so the background image will fill the empty space around it.
I want to save the result image as JPG in two different specific sizes.
How could I do that?

Related

How to export image (png) containing black rectangle

I have Image, that I made with phone Camera. I need to make some censoring and place black rectangle into Image. I want to create png Image containing black rectangle, that I can send to Backend server.
I know react-native-view-shot
but it only snaps whole display and result is in low resolution.
Is there some other way how to do it? I need to place rectangle into the original image source, not into display snapshot.

Batch resize images with different background colors

My goal is to batch resize images with different background colours.
I already used Photoshop to batch process and centre (horizontal and vertical align) 2000 different images into square 200x200 tiles on a white background (the images are different in size, background colour, and sometimes file-type).
I can process and batch resize the images and place them on a white 200x200 tile using the batch processor and recorded 'Actions'. With transparent .png images, this looks great.
The problem is that some of the images have a coloured background. If an image has a coloured background a white border around the image looks quite awful.
How do I dynamically resize the non-transparent images of different colours and sizes to 200x200 square .jpg images? I can do it manually with the colour-picker but is there another option?
As you can see it is only a problem when images have a coloured background.
Thank you in advance!
Save the following script somewhere convenient:
var myDocument = app.activeDocument;
myDocument.colorSamplers.removeAll();
var myColourSampler = myDocument.colorSamplers.add([1 , 1]);
app.backgroundColor = myColourSampler.color;
At the start of the action your going to use for your batch process, record the opening of the script (File >> Scripts >> Browse...), then go and get the script.
It will take the colour of the top left pixel and set it as the background colour, your action should do the rest

Size of image in react-native

I am wondering about an image in a view. Let's assume i have a view of 300x300 and inside i place an image of arbitrary size. I use resizeMode='contain' to fit the whole image into the view. If the image exceeds 300x300 it's fine, but if it's smaller then it stretches to the borders. Is there any way of keeping original image size if it's smaller than it's view?
Cheers!

Put an image with transparent background into a pdf using Libharu

I have to put an image (.png) into a pdf file using LibHaru. The image has a transparent background due to which it looks quite awkward (black background) into the pdf file.
How can I put this image (with transparent background) properly using C++ LibHaru?
You need to split your PNG file into two images: one for color pixels and another one for opacity values. Then you need to add the color image into PDF with specifying the second as SMASK property.
See 4.8.4 Image Dictionaries in PDF specification for more details.
You can use HPDF_Image_AddSMask method for this.

Change size of image picked from image gallery

I want to change the size of an image selected from the photo gallery. Is it possible? I'm getting an image sized (320, 290) and I want to change the image size to (480, 320).
If you don't want to change the actual image, but only how it appears, then you can plunk the image as-is in a UIImageView and then make that view any size you like. It won't look great, especially if you are changing the aspect ratio, but it does the job.