Filestack - I want to convert an image to a specific pixel size before uploading it to Filestack. How can I do that? - image-uploading

I am working on an application for watermarking a photo. The application has three main steps: 1) upload the main image file, 2) upload the watermark image file, and 3) apply the watermark to the main photo.
I want to convert the watermark to a specific pixel size, before I upload it to Filestack to perform the watermark transformation. How can I change an image file size to specific pixel dimensions before performing the upload with Filestack?

There are a couple ways to approach this issue.
The first on would be to use the 'imageDim' function within the Filestack Filepicker.
It would look like this:
client.pick({
imageDim: [400, 400]
})
After the upload is complete you can place your watermark over the image.
If you already have the image uploaded and you want to use the existing file handle, you would do it like this:
client.storeURL('https://process.filestackapi.com/resize=height:400,width:400/'+ file.handle)
You can also add the watermark call in the storeURL function.

Related

Image is getting rotated automatically by 90 degree in a web page

My code is just this:
<img src="uploads/619671548171334115-961656431.jpg" alt="a">
You can see this here yourself:
https://moviesre.com/ogb/addtestimonial/testtt.php
This is the image: https://moviesre.com/ogb/addtestimonial/uploads/619671548171334115-961656431.jpg
See it is not flipped, but in the web page it is displaying flipped. What's up?
Edit: Not all images are getting roated on this server. Some images with smaller file size (in pixel not memory) are displaying normal
Maybe your uploaded image is rotated, but is being corrected because it contains rotation data in its EXIF ('Exchangeable Image File Format' is all the information that is automatically embedded into an image file when a photo is taken using a modern digital camera) section.
You can see EXIF data of your local file from exifdata.com and also you can see EXIF data of your uploaded file (that server is providing to the browser) by using php function exif_read_data()
You can get full explanation this answer of #matt-gibson

Get image format from Scrimage Image instance

I'm working with scrimage right now, and I need to get the image format from the file, as right now, if a GIF is uploaded, it will not become an animated JPEG. I need to be able to tell if the image file is a GIF so I know to not use the Format.JPEG writer. Is there any way to do this?
In release 2.0.0-M2 you can do
val format : Option[Format] = FormatDetector.detect(in)
where in is an input stream.

Magento product resize image issue

my server getting too slow due magento's resize image. i am using following code for display image
echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(250,250)
This is load actual image (if i upload havy image like 2mb,3mb ) if i am not using resize function but if i use this function then its always resize it to 250x250 that makes server extra work of resizing image which can be done once at uploading image
i just want to avoid this resize process so every time image will not resize it should be resized when we uploading in magento when create a product. please give me solution
just skip the resizing. Everything is done in __toString() so if you remove the resize() there is no resizing and the file is only copied to the cache.
EDIT
It is important that you have the right small image uploaded in the backend. You can upload multiple images. And set three (in standard installation image, small_image and thumbnail) in the backend. These images can be access via
$this->helper('catalog/image')->init($_product, 'IMAGE_TYPE')
So if you upload a 250x250px image, mark it as thumbnail then you can remove the resize and everything works fine.
What you can do - but don't ask me how - is to put the resized images into the cache. But there are a lot of problems, after inserting them, e.g. flush the image cache -> all images are deleted

Should I use png or jpg for my image and thumbnail?

I'm taking images from the camera or the camera roll and I'm saving them to core data using an ImageToDataTransformer class. I need to use these saved images in two different places in my app: 250x250 imageview and 50x50 imageview.
First, should I use png format for both imageviews?
Second, can I compress the image before I save it to core data, and what's the best way?
Third, should I save two different images, one for the big image and another for the thumbnail in a different view?
When Xcode builds your project, it automatically optimizes PNG files included in your project. So, I guess you should use PNG.
I don't know about runtime.
That would be a good idea if you have a table view and you want to show thumbnails. You wouldn't want to be loading the huge files, that would be excruciatingly slow.

How does One place an image inside of an image using metadata?

For example, I can convert the second image into NSData and then place it inside metadata inside the first image and then when I open the first image and read the metadata I can get the NSData and turn it into an UIImage.
How would I go about doing this? All the metadata tags I see are not large enough to support another picture. I know picture in picture is quite common on desktop apps so I'm interested in getting it to work on the iPhone.
Is metadata the correct way to do this or is there another way?