How can I detect image specs clientside with javascript

喜夏-厌秋 提交于 2021-02-17 23:58:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!