mjkaufer
mjkaufer

Reputation: 4216

Detect Content Embedded in Images

I was wondering if there was any possible way to detect if there is content uploaded into images. For instance, using WinRAR, I could embed any sort of file into an image, while maintaining the images format as an image. Sites like imgur manage to block this. I am wondering how they do this.

I think one possible way would be to upload the image data to a canvas, so that it's represented purely as an array of pixels, and then reconvert the canvas's data back into an image. However, this would be rather time consuming on the server side.

Does anybody know of an efficient way to do this?

Upvotes: 3

Views: 1081

Answers (1)

Damian Krawczyk
Damian Krawczyk

Reputation: 2241

As you mentioned node.js and server side you can do the following:

1) Use imagemagic with node binding node-imagemagick - it uses cli imagemagic so it will be fast. Library is widely used so you will find plenty of examples how to remove Exif and unnecessary data from file. In worst case scenario you can recompress file.

2) If you are working with jpeg image only you can use node-jpegoptim and optimise each uploaded file. It is also using cli so will be fast

3) Finally you can use node-smushit and use Yahoo servers to do the job however you need to check if their terms of service are ok with your content.

Those are 3 that came to my mind, I hope one of those will satisfy your needs.

Upvotes: 1

Related Questions