Go Down

Topic: Resize Gif (Read 429 times) previous topic - next topic

mikeruss

I have a 900 x 600 gif image on a ESP8266 which I want to resize and display on a 320 x 240 ILI9341 screen.

Any suggestions please on how to go about this ?

thanks .. Mike

david_prentice

Resize it in IrfanView on your PC.    Fine for a stationary image.   Save it as the most convenient format e.g. .JPG, .BMP, .GIF

Animated GIFs require specialist programs.   I don't think that IrfanView will process each frame automatically.

David.

mikeruss

thanks for the reply David

I am downloading pressure maps from the Met Office every few hours on the ESP8266, and want to display them as part of my weather station. They are not animated gifs.

So the conversion needs to be done on the microprocessor.

david_prentice

#3
Mar 17, 2019, 03:46 pm Last Edit: Mar 17, 2019, 03:47 pm by david_prentice
Ah-ha.  You don't want to send stuff back and forth to a PC.   Unless you can process them with a command line.

So it is only graphics.   You can use fairly simple ways to resize.   e.g. map 3x3 pixels to one pixel giving a 300x200 image which fits your 320x240 screen.

You will have to play with the "shrinking" algorithm to get the best results.   You may need to do some anti-aliasing.   i.e. look at adjacent pixels as well as the 3x3 to determine the best colour or grey scale.

I have no experience with image processing.   But I am sure there are plenty of published papers.    After all,   IrfanView must have studied the best algorithms.

David.

mikeruss

#4
Mar 17, 2019, 04:24 pm Last Edit: Mar 17, 2019, 04:26 pm by mikeruss
thats a bit technical for me, I was hoping there would be a library or similar

might look at sending it to a Rpi, but its becoming cumbersome


david_prentice

I have displayed both static and Animated GIFs on ESP8266.

It should be simple enough to read each 3x3 block.   And calculate the average R, G, B component.   Plot this value.

There is plenty of SRAM in the ESP8266.    Copy 3 rows into a buffer.   Perform your shrink.   Draw 1 row.

But the obvious question is:   Can you configure the Met Office Server to post a smaller image?

David.

mikeruss

thank you David, it may sound simple to you but I dont know enough to do what you suggest. I am happy coding, can you point me anywhere doing something similar I can adapt ?

I dont think there is a Met Office image configuration option, its just a matter of choosing what type of result you want, pressure, rainfall etc

david_prentice

I have no idea.

But plenty of people have done Weather programs,  Aircraft programs,  ...

Google appropriately.   Interested parties will be able to help.   i.e. when you find the right Forum.

I presume that you are already using an existing Weather project.
So you have already got the project website.

It will not be trivial to do this from scratch.

David.

mikeruss

I appreciate your help David, thanks

Go Up