Author Topic: Save Image 2.3b  (Read 708 times)

Offline SierraKen

  • Forum Resident
  • Posts: 950
Re: Save Image 2.3a (Needs Testing)
« Reply #15 on: June 13, 2020, 11:24:36 PM »
Hi again guys. I just added these 2 JPG libraries to my brand new Circular Maze Generator app. Thank you for all of your help! You can check it out here:
This is my very first real JPG making program. I'm so excited. :)

https://www.qb64.org/forum/index.php?topic=2705.msg119197#msg119197


Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2593
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3a (Needs Testing)
« Reply #16 on: June 14, 2020, 11:57:16 AM »
Hi Steve, again me (the damager)

Try this code using latest 2.3a library:

Code: QB64: [Select]
  1. '$include:'saveimage.bi'
  2. Result = SaveImage("test.gif", 0, 0, 0, _WIDTH - 1, _HEIGHT - 1)
  3. '$include:'saveimage.bm'
  4.  

Give this a try and see if it fixes the issue without breaking anything else for you, Petr:

Down on line 1172 in SaveImage.BM (where the error message points to), change that line to the following:
Code: [Select]
        index256 = _RGBA(_RED32(t), _GREEN32(t), _BLUE32(t), _ALPHA32(t), I256)   
This corrects the issue you pointed out, and I don't think it'll break anything else for us -- though that is always a possibility since SaveImage has grown into such a complex interwoven series of routines which allows it to do all that it does now: export to multiple file types, dither colors, choose palettes, do compression, convert modes...  SaveImage has grown a ton from its initial conception, and with each release, it gets a little more nit picky about making certain that *everything* is working the way it should be, or else it tosses those little annoying glitches for us.

Luckily, almost all the issues are just simple little things to tweak (like changing all these commands from _RED, _GREEN, _BLUE, _ALPHA to the _32 versions instead), and the more people who test and report the problems, the quicker I can go in and get them corrected.  Many thanks for all your hard work testing the library out with all the various configurations that are possible with it nowadays!  It truly helps.  ;D
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1354
  • The best code is the DNA of the hops.
Re: Save Image 2.3a (Needs Testing)
« Reply #17 on: June 14, 2020, 12:40:34 PM »
It seems to be fine now. I may try to add BMP in 16-color and 2-color format over time, but if that happens, I'll send you the source code for approval first.

It is great, big complex work, this library.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2593
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3a (Needs Testing)
« Reply #18 on: June 14, 2020, 12:56:47 PM »
It seems to be fine now. I may try to add BMP in 16-color and 2-color format over time, but if that happens, I'll send you the source code for approval first.

It is great, big complex work, this library.

If you feel like it, feel free to add in RLE compression for our BMP files too.  They don't offer that functionality yet, and it'd be something nice to enhance them.  I've been meaning to do it forever, but with the schedule my life is currently on, we probably won't see that completed until 2022 or later.   ;D
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2593
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3b
« Reply #19 on: June 27, 2020, 09:22:33 PM »
Version 2.3b has been released, with only one minor change -- the fix to the GIF bug Petr mentioned above here: https://www.qb64.org/forum/index.php?topic=2701.msg119211#msg119211

Grab the latest, greatest version from the attachment at the bottom of the first post.  Unless somebody discovers additional issues, this version will probably be the final version which I'll do for the SaveImage library as it now:

Saves in BMP, GIF, JPG, PNG formats for all systems -- Windows, Linux, and Mac.
Converts from 32bit images to 256 color images with SteveSmart(tm) dithering.  (And some assistance from one of Rhosigma's routines.)
Works in all graphic modes -- including SCREEN 0 TEXT modes.

All code is open source, free for all, and under the "I don't give a fart" license.  Do with it whatever you want.  Alter it.  Sell it.  Abuse it.  Ignore it.  Use it in commercial products.  I don't give a fart what you do with it.  My one and only cavet is:  "I won't be held responsible if it does anything undesirable to your programs, computer, sex life, or marital relationship -- or anything else, for that matter."

Enjoy.  :P
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Forum Resident
  • Posts: 4589
  • B+ nots
Re: Save Image 2.3b
« Reply #20 on: June 27, 2020, 10:49:56 PM »
Thanks again! Curious what it will do to my marital relationship :)

Offline SpriggsySpriggs

  • Seasoned Forum Regular
  • Posts: 259
  • DIM JohnSilver AS LONG, yarn AS STRING
    • My GitHub
Re: Save Image 2.3b
« Reply #21 on: June 27, 2020, 10:58:49 PM »
Thanks again! Curious what it will do to my marital relationship :)
I should think it would save it quite nicely ;)

Offline RhoSigma

  • Seasoned Forum Regular
  • Posts: 370
  • Use multiple Desktop windows with GuiTools.
Re: Save Image 2.3b
« Reply #22 on: June 28, 2020, 02:50:00 PM »
Hi Steve,
have just encountered a tiny issue with the JPG export.

Just use your SaveImageDemo.bas and let it export all 4 image formats. Then, when it loads back the exported images using _LOADIMAGE, explicitly pay attention when it changes from the .bmp to .jpg display (you can also use any other picture viewer to recheck later).

It seems the JPG image is divided into 4 quadants (probably the way JPG works, ???) and each quadrant section is moved toward its outer corner by 1-2 pixels, doubling the inner pixels (hence the vert/hori center axis of the picture) to fill the gap.

I know it's hard to spot and it may not hurt the visual impression of most pictures in any way, but maybe you wanna have a look on it before finalizing the library.

Could it be introduced by the _WIDTH - 1, _HEIGHT - 1 bugfix ?

Interested in my QB64 Stuff?
GuiTools Framework, Blankers, QB64/Notepad++ setup ...
Libraries (MD5/SHA2 hashing, DES56 encryption, LZW packer, File/Data buffers, Image processing, C++ stdlib wrappers and more)
see here: https://www.qb64.org/forum/index.php?topic=809.msg100182#msg100182

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 2593
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3b
« Reply #23 on: June 28, 2020, 03:07:56 PM »
I'll dig into it and see what I can come up with.  The JPG routine I'm using was modified from one QB64 already included in the samples package, so I didn't check it the most for bugs.  I figured if it's been around for 10+ years without anybody noticing any issues, I wasn't going to root around too much and add any!  ;D

I'll report back soon(tm) and let you know what I come up with (if anything). 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!