1

Is there any way to determine width and height of gif image with JavaScript. I have no google result of this. Please let me solve the problem. It's related to this post.

Getting Duration of Gif Image in JavaScript

Dapp Composer
  • 176
  • 1
  • 12
  • 2
    Does this answer your question? [How to get image size (height & width) using JavaScript?](https://stackoverflow.com/questions/623172/how-to-get-image-size-height-width-using-javascript) – Justinas Oct 15 '21 at 08:54

1 Answers1

4
 const img = new Image();
 img.onload = function() {
 alert(this.width + 'x' + this.height);
 }
 img.src ='your image path here';
  • 3
    thanks. It works for me. – Dapp Composer Oct 15 '21 at 19:56
  • 2
    While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. You can find more information on how to write good answers in the help center: https://stackoverflow.com/help/how-to-answer . Good luck – nima Oct 16 '21 at 12:51
  • 2
    Thanks for this valuable information @novonimo – Ahmed amin shahin Oct 16 '21 at 13:55