问题
I want to validate image file uploads client side. T here will be server side validation, too, which is working already with image magick.
I would like to reproduce this on the client side before uploading (since the files will be quite large and prerequisits for the image files are very restricted, it could save the user much pain if the validation takes place in the browser before the upload process)
Allowed files would be:
JPEG
EPS
TIFF
I need to detect:
Color Space (CMYK / RGB)
Size (width x height) // this one is easy - on JPEGs, but how about TIFF and EPS?
Resolution (dpi)
The main problem is detecting color space and handling the non-JPG formats. Is there something like ImageMagick's "identify" for javascript or do you have any other ideas...?!
回答1:
Take a look at this. It uses HTML5 APIs, but it looks like what you are looking for.
来源:https://stackoverflow.com/questions/18061324/how-can-i-detect-image-specs-clientside-with-javascript