Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:49 29 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Problem with JPG/BMP and Waveshare RP2040-LCD-1.28

     Page 2 of 2    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 02:10pm 20 Apr 2023
Copy link to clipboard 
Print this post

Frank

Looks like this is just an oddity. I certainly can't start digging about in the guts of the 3rd party jpg decoder so we will need to just ignore this one now you can create a good image.
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 831
Posted: 02:46pm 20 Apr 2023
Copy link to clipboard 
Print this post

Peter,
for me, this behavior is not a problem - I just wanted to draw attention to it...

But..., I still haven't managed to get a good picture! Even if I edit it with Martins ditherer (Martin, THANKS for the link to the online ditherer) it doesn't look very good when I load it from your program and it looks different when I load it directly from the console.
Can you really not tell me how to convert an image properly? All my attempts have been unsatisfactory. What tools did you use for this?

Frank
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 03:13pm 20 Apr 2023
Copy link to clipboard 
Print this post

Frank

I think you are expecting too much. The framebuffer concept was designed for games and graphics where the user selects one of the 16 available colours. From what I can remember I took an image of a watch face and converted it to two colour (black and white) and then changed everything black to brown.
I use a very old copy of PaintShopPro V7 for image editing
I can't find the image as not at home and it doesn't appear to be on my Dropbox
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6812
Posted: 04:02pm 20 Apr 2023
Copy link to clipboard 
Print this post

You'll not get photo quality images with 16 colours, Frank. Dithering helps, but that's the best you'll get. You can't even get a really fine dither, that would really help, because of the limitations of the display's dot pitch. Everything that is displayed via the framebuffer has this problem, no matter what it is.

If you can load a picture directly into the display that's different. You can then make use of the full colour resolution that the display is capable of. You can't do anything with the image though. As soon as you try the framebuffer gets involved and you are back to 16 colours.

Some image programs will let you do colour reduction. You tell them how many colours are available and they will pick the closest. Sorry, I can't suggest one. I have a feeling that GIMP will do it. Probably Photoshop too.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6102
Posted: 09:36pm 20 Apr 2023
Copy link to clipboard 
Print this post

There are many different versions of jpg and it looks like the jpg routines used in Pico-MMBasic don't like the version you have.

If you are using Windows, load the jpg in Paint and simply save it with a different name.

The file will be larger but it does now load (on my pico)


JPG is NOT a good choice for dithered images. You really should be trying BMP but I still think you will be disappointed.

I use Graphic Workshop (not free) for image manipulation.

Jim
VK7JH
MMedit   MMBasic Help
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 831
Posted: 08:08am 21 Apr 2023
Copy link to clipboard 
Print this post

@Peter:
Thank you very much for your efforts! Silly question: The color table is set in MMBASIC? Or is it in the image information?

@Mick:
You are right! But what bothered me the most were the wrong colors...

@Jim:
Thanks for the hint with the BMPs and PAINT. I have now been able to create an acceptable image using Martin's ditherer and Volhout's color table and then convert the PNG to a 4-bit BMP using PAINT. The result is acceptable.

Thank you all for your help!!!

Frank
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6812
Posted: 09:18am 21 Apr 2023
Copy link to clipboard 
Print this post

The colours on the PicoMite are decided by the resistor values used. The GP pins merely output a 4-bit count and the resistors convert it to analogue voltages for VGA display. You can do what you like with the 4 bits. 16 grey-scale shades from black to white would be relatively easy.

Because of the above, truly wrong colours *must* occur between the GP pins and the VGA output. It has to be a hardware problem as the PicoMite actually has no concept of colour other than output a certain bit pattern for a given colour name. If the hardware is correct then any apparent wrong colours have to be because colour reduction or dithering is creating the wrong 4-bit values.
Edited 2023-04-21 19:21 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 831
Posted: 09:27am 21 Apr 2023
Copy link to clipboard 
Print this post

No, no, no - the "Waveshare RP2040-LCD-1.28" is a SPI display + integrated Picomite. This is NOT a PicomiteVGA.



Frank
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6812
Posted: 09:45am 21 Apr 2023
Copy link to clipboard 
Print this post

Oh, sorry....  :)  My fault. I've been thinking VGA all morning. lol

Some of it still applies though. When you put graphics or a picture into  the frame buffer it writes 4-bit colour values. (2 per tile in Mode 1 or 1 per pixel in Mode 2). There isn't enough memory available for a frame buffer big enough to handle more bits. That's why, when any picture is loaded into the frame buffer it is reduced to 16 colours.

Squirting the picture data over SPI directly to the display doesn't have that problem.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 831
Posted: 10:11am 21 Apr 2023
Copy link to clipboard 
Print this post

No problem!

  Quote  That's why, when any picture is loaded into the frame buffer it is reduced to 16 colours.

Yes, but which 16 colors? Are these colors defined in the BMP/JPG or in the Picomite? With dithering 16 colors are sufficient...

Frank
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9139
Posted: 10:18am 21 Apr 2023
Copy link to clipboard 
Print this post

The bmp defines the colours that the picture wants
MMbasic then maps those on to the colours available by shifting red and blue 7 places right and green six places right to give RGB121.

There even happens with a colour LCD display. For example the ILI341 is RGB565 so MMBasic shifts the blue and red colours in the bmp 3 places right and the green 2 places right

In the case of a framebuffer and this display
you lose colour loading the full colour RGB888 bmp to the RGB565 display and then again saving the display to a RGB121 framebuffer

See the VGA manual for details of the 16 colours in RGB121
Edited 2023-04-21 20:20 by matherp
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 831
Posted: 10:42am 21 Apr 2023
Copy link to clipboard 
Print this post

Peter,
thanks a lot for your explanation!

One last question, do you have an explanation for why this image (dithered in 16 colors with Volhout's table and saved with Paint as a 4 bit BMP) looks different from the console with LOAD IMAGE than it does when loaded into the framebuffer by your program?
D.zip





It seems somehow brighter and coarser...

Frank
Edited 2023-04-21 20:58 by Frank N. Furter
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024