0

So I have an image that when I do

 console.log(image);

This is what appears on the console,

Object {imageFormat: "image/jpeg", imageB64: "..gibberish..."}

What I want to be able to extract the dimensions of the image, size of the image so that I can do conditionals and send it to a server.

I did something like this.

console.log(image.naturalHeight + " x " + image.naturalWidth);

but all I get is

 undefined x undefined 

Take note that I also need the size please.

Just started to pick up Javascript so some terms may be unknown to me, please be kind with your comments.

tl;dr, how to obtain image properties?

Hatchet
  • 5,320
  • 1
  • 30
  • 42
Ming Jin
  • 331
  • 1
  • 5
  • 17
  • Is the image fully loaded, what browser are you using? – epascarello Jul 21 '16 at 14:28
  • like this? https://github.com/exif-js/exif-js (could not find any docs), [answer from here](http://stackoverflow.com/questions/5929356/read-meta-data-from-image-file-with-javascript) – Barthy Jul 21 '16 at 14:30
  • @epascarello yes fully loaded, and after some cropping. The image is taken from a camera and is in base64. – Ming Jin Jul 21 '16 at 14:40
  • @Barthy not really sure what metadata and exif is.. How is this helpful btw? :) – Ming Jin Jul 21 '16 at 14:42
  • Well metadata is just a fancy word for properties in this case (I think) and exif is something that will help you extract them from the images. – Barthy Jul 21 '16 at 14:47

0 Answers0