How to Validate a Common Image File Format using Golang

If your website is accepting a wide variety of image formats for upload, you’ll need a data validation service that can keep up. Our Validate Image File API supports dozens of common image formats — including JPG, PNG, GIF, etc. — and quickly returns a Boolean value indicating if the file in question is valid or incorrectly formatted. Along with this Boolean response, this API will determine if the file is password protected (a big red flag!) and supply both an error and warning count with descriptions for each.

To build this API into your application, all you need to do is copy the Golang code examples below into your environment and validate the service with a Cloudmersive API key (which you can get by registering a free account on our website; free-tier keys supply a limit of 800 API calls per month). Add your key & file inputs in their respective (labeled) fields, and you’re ready to make your call:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.