QB64 Phoenix Edition
program that stitches together a bunch of image files into one giant poster? - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: program that stitches together a bunch of image files into one giant poster? (/showthread.php?tid=3153)

Pages: 1 2


program that stitches together a bunch of image files into one giant poster? - madscijr - 10-23-2024

Before I go and reinvent the wheel, I'm wondering if this or something similar already exists...? 

I'm thinking a program that 
  • looks in a directory like "c:\Users\MyUser\Pictures"
    (extra points if it can handle environment variables like "%USERPROFILE%\Pictures") 
  • finds all images (extra points if it lets you specify 1 or more wildcards to match like "*.jpg;*.png;*.gif")
  • gets the size of all of them and figures out (based on layout chosen) how big the final image will be & initialize it
    (I'm not sure what kind of limitations QB64PE has for image size, I am thinking this prog would limit the size only based on the computer memory & hard drive space)
  • for each pic:
    loads it into memory,
    resize/scale/rotate (depending on options)
    copies to a new giant image (depending on the layout you choose,
    e.g., if we have 16 pictures, maybe 4 columns x 4 rows, or 8 columns x 2 rows)
  • outputs a new image file in the selected format. 

I'm thinking of some fancy features like if the pictures are different sizes, it can resize them / rotate them / stretch them, depending on what you can choose, to whatever the largest common dimension is, or maybe it can detect a picture's orientation, and auto rotate so they are all landscape or portrait, or figure out how to lay them out so there is minimal blank space. 

Maybe an option to not rotate but fill in the blank space with a given background color, or if there are not enough pics for an even # of rows/columns, fill in empty areas with some default color or pattern.

Some of the things I'm going to have to figure out how to do for this include 
  • list files from a folder
  • match based on *? wildcards
  • load an image file into a _NewImage
  • detect image height/width
  • rotate image
  • scale/resize image
  • stretch/skew image
  • display an image bigger than the screen shrunk down to fit the screen (to preview on screen)
  • save image from memory to a file

Simple use cases: 
  • make a pic collage for your PC's desktop 
  • take a bunch of pictures and turn them into a poster you can have printed at somewhere like CVS (the web site says 24"x36" is $15.99 ?!)
  • make a background for a game

Has anyone seen or done anything like that?


RE: program that stitches together a bunch of image files into one giant poster? - Petr - 10-23-2024

Interesting idea. Look here https://qb64phoenix.com/forum/showthread.php?tid=3086, from the last source code select SUB LoadFiles and all the necessary SUB, Declare Library and Functions that DirEntry.h needs (it's in the ZIP file). LoadFiles takes all images from a folder and tests them for validity and usability in QB64. The rest of what you describe, you really have plenty of room for imagination and for various effects. Use the _Width and _Height functions to find out the dimensions of images, the latest IDE has the SaveImage function to save them in many formats. Also look at the _File$ function, you might be able to use that to search for images on disk.

For image rotation find RotoImage in the forum.


RE: program that stitches together a bunch of image files into one giant poster? - madscijr - 10-23-2024

(10-23-2024, 08:29 PM)Petr Wrote: Interesting idea. Look here https://qb64phoenix.com/forum/showthread.php?tid=3086, from the last source code select SUB LoadFiles and all the necessary SUB, Declare Library and Functions that DirEntry.h needs (it's in the ZIP file). LoadFiles takes all images from a folder and tests them for validity and usability in QB64. The rest of what you describe, you really have plenty of room for imagination and for various effects. Use the _Width and _Height functions to find out the dimensions of images, the latest IDE has the SaveImage function to save them in many formats. Also look at the _File$ function, you might be able to use that to search for images on disk.

For image rotation find RotoImage in the forum.
Sounds promising - thanks for all that info! 
I'll post some code as soon as I have something working.


RE: program that stitches together a bunch of image files into one giant poster? - Pete - 10-23-2024

Well, sort of. Once I put together a pic of Steve and a farm animal. It was costly. I had to rent a tractor to pull them apart! Big Grin 

This sounds like a lot of sub-general AI work if you're not intending to slave a lot of it out. I don't recall in 30+ years, working with QB, of ever hearing of such a project; so I think you have a pretty unique idea. You're young, right?

Pete


RE: program that stitches together a bunch of image files into one giant poster? - Jack - 10-24-2024

maybe this https://download.cnet.com/download/image-composite-editor-64-bit/3000-2192_4-75207152.html
or from https://web.archive.org/web/20190223050207/https://download.microsoft.com/download/7/3/9/73918E0B-C146-40FA-B18C-EADF03FEC4BA/ICE-2.0.3-for-64-bit-Windows.msi 64-bit
https://web.archive.org/web/20190309221948/https://download.microsoft.com/download/A/7/8/A7804C73-ECDB-4459-BB3E-A7F13C4C5382/ICE-2.0.3-for-32-bit-Windows.msi 32-bit

I used it eons ago and it worked quite well back then


RE: program that stitches together a bunch of image files into one giant poster? - madscijr - 10-24-2024

(10-23-2024, 10:50 PM)Pete Wrote: Well, sort of. Once I put together a pic of Steve and a farm animal. It was costly. I had to rent a tractor to pull them apart! Big Grin 

This sounds like a lot of sub-general AI work if you're not intending to slave a lot of it out. I don't recall in 30+ years, working with QB, of ever hearing of such a project; so I think you have a pretty unique idea. You're young, right?

Pete
LoL young? Is this going to take years to finish? 

Youth is relative - I missed out on the days of punch cards and paper tape, but just for reference, I was introduced to computers and BASIC programming in middle school on the TRS-80 Models 1 & III, and my first computer was a 16k Texas Instruments TI99/4A ($49.99 on clearance from K-Mart!) with a cassette recorder. The year after, upgraded to a Commodore 64 and was off to the races! 

Anyway, hopefully we'll see some kind of working prototype in the next week or 2, with luck!


RE: program that stitches together a bunch of image files into one giant poster? - madscijr - 10-24-2024

(10-24-2024, 12:19 AM)Jack Wrote: maybe this https://download.cnet.com/download/image-composite-editor-64-bit/3000-2192_4-75207152.html
or from https://web.archive.org/web/20190223050207/https://download.microsoft.com/download/7/3/9/73918E0B-C146-40FA-B18C-EADF03FEC4BA/ICE-2.0.3-for-64-bit-Windows.msi 64-bit
https://web.archive.org/web/20190309221948/https://download.microsoft.com/download/A/7/8/A7804C73-ECDB-4459-BB3E-A7F13C4C5382/ICE-2.0.3-for-32-bit-Windows.msi 32-bit

I used it eons ago and it worked quite well back then
Thanks Jack, I'll check those out! 

BTW does anyone know when archive.org will have the archived software, videos, music & other content back up? I sorely miss all that stuff! Dang hackers, go pick on someone worth picking on!


RE: program that stitches together a bunch of image files into one giant poster? - Pete - 10-24-2024

So that's why K-Mart was out of stock when I showed up!

I only posted that because I actually did buy exactly that model as my first computer and it was purchased from K-Mart.

Pete Big Grin 

- It's a small world, so there will be plenty of opportunities to boot Clippy in the ascii.


RE: program that stitches together a bunch of image files into one giant poster? - madscijr - 10-24-2024

(10-24-2024, 01:18 AM)Pete Wrote: So that's why K-Mart was out of stock when I showed up!

I only posted that because I actually did buy exactly that model as my first computer and it was purchased from K-Mart.

Pete Big Grin 

- It's a small world, so there will be plenty of opportunities to boot Clippy in the ascii.
Haha beautiful! 
LoL


RE: program that stitches together a bunch of image files into one giant poster? - grymmjack - 10-24-2024

imagemagick convert.
https://imagemagick.org/script/convert.php

example:
Code: (Select All)
# horizontal:
convert *.jpg +append output.jpg
# vertical:
convert *.jpg -append output.jpg

replace the *.jpg and output.jpg with your desired formats/filenames.

Code: (Select All)
convert %1.png -alpha set -channel RGBA -fuzz 1%% -fill none -floodfill +0+0 black -interpolate nearest -interpolative-resize 400%% %1-rs.png

In the above example, it sets alpha, sets snap for colors (fuzz), sets no fill, fills with transparency, interpolates as nearest (pixelized) and resize to 400%. if you wanted to do this for a batch you'd use:
Code: (Select All)
convert *.png -alpha set -channel RGBA -fuzz 1%% -fill none -floodfill +0+0 black -interpolate nearest -interpolative-resize 400%% -append spritesheet.png
(or +append) if you want horizontal