Author Topic: Save Image 2.3d  (Read 13024 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
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: 3972
    • View Profile
    • 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: 1720
  • The best code is the DNA of the hops.
    • View Profile
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: 3972
    • View Profile
    • 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: 3972
    • View Profile
    • 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

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
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

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • 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 ;)
Shuwatch!

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
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 quadrants (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 ?

« Last Edit: March 22, 2021, 10:43:46 am by RhoSigma »
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • 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!

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3c
« Reply #24 on: November 03, 2020, 03:05:28 pm »
Version 2.3c has been released, which is a small bug fix for the issue described by Petr here: https://www.qb64.org/forum/index.php?topic=3199.0

Basically, saving JPG files were using a hard coded file handle; now they're not.  This little patch makes proper use of FREEFILE, to prevent any handle conflicts from occurring with us.  Old code, which didn't produce any glitches for you, won't need any updates.  Chances are, either you're not saving JPG files, or else you simply don't have the same file handle in use at the same time.  This is a very minor little change (basically from OPEN file AS BINARY #1 to OPEN file AS BINARY #f), so replacing it in existing code isn't a must-do exercise, but I'd suggest using it for future projects just to avoid any sort of possible conflicts before they can occur. 

Download has taken the place of the old attachment at the bottom of the first post in this subject, so that it'll be the one any new users will find and grab from now on.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Bolee

  • Newbie
  • Posts: 4
    • View Profile
Re: Save Image 2.3c
« Reply #25 on: February 18, 2021, 02:22:35 am »
Hi all.

I downloaded the Version 2.3b at https://www.qb64.org/forum/index.php?topic=1651.0 and then found  and then found the Version 2.3c here.

I am new to the forumn and qb64 but hopefully I will start playing around with save image when converting some of my VB6 graphics programs. I have also played around with FreeBasic. I came to the qb64 site by accident after searching around on the net for basic type coding sites. I used to upload to Vb Planet code source before it disappeared during the bad "covid " period of last year.

I am very impressed with the fractal programs that I have seen on this site and the wealth of knowledge. Nice to come across some like minded creative people. Take care all.

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Save Image 2.3c
« Reply #26 on: March 22, 2021, 09:57:26 am »
Hi

Just wondering if anyone has created an "Option _Explicit" friendly version of save image before I go ahead and create one myself.

Brian ...
Brian ...

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3c
« Reply #27 on: March 22, 2021, 10:04:37 am »
Hi

Just wondering if anyone has created an "Option _Explicit" friendly version of save image before I go ahead and create one myself.

Brian ...

Not that I know of.  I don’t personally use Option _Explicit, so it’s not something I generally code towards.  If you (or anyone else) wants to take time to declare all the variables, and share them, I’ll add the changes into the library and make certain they’re available for everyone else from now on. 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline 191Brian

  • Newbie
  • Posts: 91
    • View Profile
    • My Itch page
Re: Save Image 2.3c
« Reply #28 on: March 22, 2021, 04:18:05 pm »
Hi @SMcNeill

I tried but after declaring the variables if I try to run the demo program I get the following error.
 
Critical Error #300
---------------------------
Line: 434 (in SaveImage.BM)
Memory region out of range

That line is "check = _MemGet(m, m.OFFSET + i + 3, _Unsigned _Byte)" in Function PNGExport (file$, imagehandle%, x1%, y1%, x2%, y2%)

Unfortunately I don't yet understand the _MemGet function so am stumped for now.

 
* SaveImage OE.zip (Filesize: 17.27 KB, Downloads: 226)
Brian ...

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Save Image 2.3c
« Reply #29 on: March 22, 2021, 05:35:17 pm »
Right now, I’m stuck down at my mom’s, watching over her.  (She has early onset Alzheimers and has to be monitored 24/7.). Usually my sister takes her about half the time, but the doctors just diagnosed her with breast cancer.  She’s got to go talk to the surgeons on the 30th of this month, so I’ll be stuck here for at least another month.  If things settle down in a few weeks, I’ll try and set aside time to make SaveImage Option _Explicit compatible. 
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!