Specify image dimensions? - ruby-on-rails

I'm looking for a way using the filepicker-rails gem to specify the image size. For example I would like to make it so my users cannot upload an image smaller than say 400 x 600 pixels.
Reading the docs I can only find the max file size in bytes, nothing about dimensions. Does anybody know how to accomplish this?

For now FilePicker API doesn't provide a feature of limiting files' sizes by dimensions (only by bytes as you have already mentioned).
What you could do is check the dimensions' of files and if they are lower than desired (400x600 in your case) then convert them to this minimum size using FilePicker's conversion feature.

Filepicker's new API has an option Image Dimensions where you can specify the height and width. With this local images with be upscaled or downscaled before the upload begins.
https://www.filepicker.com/documentation/file-ingestion/javascript-api/pick

Please check the specs and you-ll find out how to use the max_size :)

Related

Dart - How to get the Image height and width of a png file?

Is there a way in getting this sizes? Using command line. Thanks in advance. and can I ask something good tutorials in Dart?
I don't know a built-in feature that allows to do that except readying the content byte-wise and interpreting the values like explained for C++ in C++ How to get the Image size of a png file (in directory)
The image package seems to provide this functionality though. decodePng returns an image that has a width and height property.
The build-in function decodeImageFromList() can help you with that. Its callback contains an Image that includes the width and height.

Displaying vector Maps in iPad

I am working in an App which displays the maps. I want to increase the zooming quality of the maps. For zoom to be clear, it should display the vector maps. I have vector maps in .svg format. After lots of searching I found that I can use pdf format or I can use the third party library like SVGKit. I am getting which approach I should follow.
Please suggest me the approach. Also, is it possible to draw the vector maps in the code itself?
Thanks & Regards,
Priya
As you can see Apple Image size iPad Pro size is 2732 x 2048 (landscape) mode so you don't need a image size for the 4096 × 3140 its really really big,
so make all images based on your need for the consider 2732 x 2048 and then use it.
You can compress image by using https://tinypng.com/ its really good and 50% compress image size without loosing its quality.

Responsive image size both image (pixel) size and file (byte) size just like in Google plus

The link below is an example image link I got from google plus. If you change the width value of the URL, the image size change as well and it has a smaller file size. For example, change the width from 1017 to 100
http://lh6.googleusercontent.com/-Eanf6uMoTPI/VaP0qYA_jUI/AAAAAAAAJcc/dOua5XQcjPE/w1017-h678-no/IMG_9439.jpg
File size: 216.8kB
http://lh6.googleusercontent.com/-Eanf6uMoTPI/VaP0qYA_jUI/AAAAAAAAJcc/dOua5XQcjPE/w100-h678-no/IMG_9439.jpg
File size: 12.5 kB
Can someone please give an advice on how can I have this feature in my web application, regardless if it uses file system or database. This feature is ideal for displaying thumbnails or resizing images.
Thanks in advance
My solution to this (by the way) was to use SLIR application by Lencioni. It can crop or resize without altering the original image. It uses a cache to store the resized images to lessen the server load.
https://github.com/lencioni/SLIR

How can I set an custom icon for my app made for IOS on codename one

Hello there am trying to set up a custom icon for my IOS app. Am using the option for setting up the icon given on the properties section. Each time I upload a png image it keeps rejecting it and asking for image with dimension of 512 x 512. The image I keep trying to upload is of that size. But is still wont take it. Is there a way of fixing this?
Make sure the image is 512x512 exactly and in PNG format.
Very strange. You'd like to be care of 2 things following:
PNG format and 512 x 512 size exactly.
Make sure the file extension is uppercase, such like "icon.PNG".
I was very surprised by this uppercase extension issue.
Good luck~!

Calculate the height and width of image from the source file

I need to calculate the image width and height from the actual image file, so I'm reading the image with open file. so I have bunch of characters and numbers and everything that seems meaningless and they are presenting rgb information probably.
I just want to calculate the size of the image with the raw file information
I am programming in Erlang language but the code in any language will help as we are working with raw file as long as we don't use built-in libraries.
Thank you all in advance for help
I found the answer by going to details of each format,
So it works like this
JPG : you can find the width and height after the bytes "255,192,0,17,8" after that its the information for size
PNG : you can find it after "IHDR"
GIF : you can find it after "GIF89a"
there are information for more but this is the most common image types on internet
Thank you all for your time
I assume when you say 'raw' you mean you only have the pixel values.
In this case there isn't always a way to know the width and height.
Say you read 400 pixels. In this case a valid image side may be any whole factorization of 400, e.g. 1x400, 2x200, 4x100, 8x50, 20x20 etc. and transposed as well.
Not to mention the fact that many image formats include some padding for pixel rows that are not multiples of 4, 8 or 16...
The way it is coded in the image file depend on the image type, which hopefully is also coded in the image file. you can have a look at the question Getting Image size of JPEG from its binary for an example with JPEG coding.
If your data is unknown, use Octave and load the image. Then take a look at this page:
http://www.gnu.org/software/octave/doc/interpreter/Displaying-Images.html
for commands to display images. Hopefully with some manipulation it will work. This works for raw images, though there are specific decoders. Once you understand how the image is, you can write the equivalent C code.

Resources