Here is the image I want to unglue into seperate pictures! John
Main Topics
Browse All TopicsI have a 200X21000 pixel picture that needs to be broken into 105 200x200 pictures, is there a application that does this? John
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
A mosaic creator?
http://www.andreaplanet.co
Mosaic software?
http://www.andreaplanet.co
Hmmm, Philip has had 6 hours, so I'll attach my cropped images as a Zip file and describe my method using the free IrfanView image viewer/editor and a batch file designed for Windows 2000 upwards (also attached).
IrfanView:
http://www.irfanview.com/
http://download.cnet.com/I
Plugins if desired:
http://www.software.com/ir
IrfanView supports the following useful Command Line Options:
/killmesoftly
Close all IrfanView instances (exit after command line)
/silent
Don't show messages for command line read/save errors
i_view32.exe /crop=(x,y,w,h)
Crop input image: x-start horiz, y-start vertical, width, height
Examples for crop:
Open "c:\test.jpg" and crop: x-start=10, y-start=10, width=300, height=300
i_view32.exe "c:\test.jpg" /crop=(10,10,300,300)
i_view32.exe "c:\test.jpg" /crop=(10,10,300,300) /convert=c:\giftest.gif
The /convert switch does batch file format conversion, but if you specify the same file type it just works as a renaming command, so I would use that option in method 1.
OK, so I would suggest that you should be able to perform what you need using either of the batch file methods as follows:
METHOD 1
========
1. Copy the image 115 times using logical sequential file names.
This Batch file would do the copying:
@echo off
for /L %%a in (1,1,105) do copy activity.jpg activity_%%a.jpg
exit
This creates copies as "activity_1.jpg", "activity_2.jpg", up to "activity_105.jpg".
I can alter the batch file attached so that it prefixes the cropped images with a number and file name eg. "111_activity.jpg" if preferred, but that gets sorted in the Windows quirky way that groups numbers.
2. Run a separate "crop" command on each *.jpg file that specifies a different x (hozizontal axis) and y (vertical axis) starting points. Your image is 200 x 21000 pixels, so x will always be zero. You just need to step down 200 pixels on the vertical (y) axis each time for your new starting crop position.
This requires a bit of mathematics, which I am terrible at, but 21000 divided by 15 logically equals 200. The following are the first 3 commands added to the original batch file telling IrfanView to crop the first 3 files, because that's all I can work out ;-)
start /b /wait C:\Progra~1\IrfanView\i_vi
start /b /wait C:\Progra~1\IrfanView\i_vi
start /b /wait C:\Progra~1\IrfanView\i_vi
....... etc .....
start /b /wait C:\Progra~1\IrfanView\i_vi
3. Each separate image file will be cropped down to only the square you need.
To use the attached batch file, do as follows:
Save "Crop-Convert-cmd.txt" and then rename it to "Crop-Convert.cmd", accepting the warning about changing file types.
Make sure it is in the same folder as your "activity.jpg" image file, and preferably use a copy of it. Although the batch file appears to work on a folder path with spaces in the names, I suggest that you use it in one without spaces created for this purpose, eg. "C:\CROP"
Install IrfanView to the default path of "C:\Program Files\IrfanView". The program executable will be in there as "i_view32.exe". Because the batch file is calling i_view32.exe with the parameters it needs there is no need to configure the program first, although it's always better to have a properly configured program installed.
TIP: Don't associate IrfanView with any file types except perhaps for some of the unusual ones not handled by your default image editor.
Double-Click on your batch file "Crop-Convert.cmd" and allow it to run.
METHOD 2
========
I didn't do one because Method 1 works fine. I was going to use a FOR loop in the batch file to avoid creating all the 105 temporary copies of the image and just use an incrementing variable to crop and convert the image to a new file name with each loop, but I can't really be bothered ;-)
Bill
Nope, the function is down. The narrow box is scrollable and I can just see "down for maintenance" peeping through as I scroll. I'll try again later.
The resultant cropped images are from 1 to 9 KB in size, and the zip file (which contains the 169KB original image) is 581KB, so that's well within the 50MB maximum file size that can be attached here.
Hey, you don't have to call it "soccer". It's Fitba' in Scotland, and is normally accompanied by either something from the Chippy or a Chicken Tikka Tandoori Masala, a few cans of Irn Bru is you're teetotal or driving, or else a few cans of Tennants if you have no taste buds or imagination. I'm only 45 minutes away from you, but thankfully I have no great interest in Rangers, Hearts, Celtic, Hibs, or any of the rest of them. Enjoy your night, I'm just about to phone for Mixed Pakora and Chasni myself and then see what songs Jonathan and Edward can screw up this week on X-factor and still get through.
Hi John
Uh oh, didn't the batch file work?
What is your operating system?
I am testing this on Windows XP, so it should work with Windows 2000 and Vista, but I can't be sure because I don't have any computers running those.
I have had some failures when I enclose the path to IrfanView's i_vew32.exe in quotes and leave the path unaltered, ie.
"C:\Program Files\Infanview\i_view32.e
It usually comes up with a dialog error that i_view32.exe cannot find the file, so I tend to just cut down the "Program Files" to "Progra~1" but leave the "Irfanview" folder with its 9 character file name. Using "DOS" 8.3 file names, it should really be as you have done with "Irfanv~1", but I've found that it still works with the full "Irfanview" folder name.
I can't see any reason from your example line that the command should fail. The system variable %CD% should always be the "Current Directory", and should therefore be expanded to the directory that the batch file is being run from when executed. The easiest way to test this is to add the lines:
echo Current Directory is %CD%
pause
up near the top of the batch file.
Another way to store the Current Directory is using the %0 variable and modifying it. %0 should store the full path to your batch file if used within your batch file, and modifying it to %~dp0 should then store the full path to the batch file with a trailing backslash. I don't like using that because you end up with something like this:
"%~dp0activity_105.jpg"
Note the absence of the backslash because the variable already has the path stored with the trailing backslash. You can do this type of thing to get rid of it:
set CurrDir=%~dp0
set CurrDir=%CurrDir:~0,-1%
C:\Progra~1\IrfanView\i_vi
When it comes to it, you should theoretically be able to declare all the paths at the start of the batch file and then use the variables in the commands like this:
@echo off
set IVIEW=C:\Progra~1\Irfanv~1
set ImgPath=D:\boot\pics
start /b /wait %IVIEW% %ImgPath%\activity_105.jpg
In theory that should work, but Irfanview is a bit quirky with what it accepts on the command line. It also insists that all command line switches must be lowercase, so /CROP and /SILENT will not work.
I added a start /b /wait command at the beginning of each line to ensure that batch processing waited for the IrfanView command to complete before executing the next. In previous versions of "DOS" this was necessary, but Windows XP (and probably 2000 and Vista) seem to wait anyway, so it may not be necessary. The /b switch just tells it not to open a new "DOS" window for each command.
By the way, to create batch files like this I tend to use Excel to create the number lists in columns and then populate the other columns using copy and paste. I then Save as a *.csv file, rename as *.txt, and use the Find and Replace to get rid of the unwanted commas and quotation marks, add spaces, etc. It looks like a laborious exercise, but you would quickly see it's quite quick if you wanted to test without the start /b /wait comand at the start of each line. Do it on a copy of the batch file:
Find start /b /wait <space>
Replace with nothing
Similarly you could test another copy by replacing paths with variables, etc.
I can try to modify the batch file if you wish, but let's see if the images are suitable for you, in which case you may not need to use the batch file at all. Unfortunately the attachment function is still not working yet. Hopefully it will be functional soon.
Bill
Wait up.
I modified the batch file and have attached the revised version as "Crop-Convert_02-cmd.txt".
I used the modification I mentioned above:
set IVIEW=C:\Progra~1\Irfanv~1
set ImgPath=D:\boot\pics
and then:
Replaced all instances of:
start /b /wait C:\Progra~1\Irfanview\i_vi
with:
%IVIEW%
Replaced all instances of %CD% with %ImgPath%
I have just tested the revised batch file by creating a new folder D:\boot\pics and copying "activity.jpg" into it. The batch file now runs from any folder on my XP system.
Note: If you wished to permanently set the path to i_view32.exe so that you did not have to specify a path to it, there are two methods that work with Windows XP:
Registry using a *.reg file or manually in REGEDIT (works for Windows 2000 and XP, but not sure about Vista):
Open Regedit and create a new sub-key named i_view32.exe under the key:
[HKEY_LOCAL_MACHINE\SOFTWA
(note the space in "App Paths". Some tweaking progams and setup packages wrongly create a new key named "AppPaths").
Click on the new "i_view32.exe" key, then double-click on the (Default) String Value (REG_SZ), or Right-Click > Modify. In the "Value Data" field of the Edit String dialog, insert the path C:\Progra~1\IrfanView\i_vi
Create a New String Value named "Path", then Edit it to C:\Progra~1\IrfanView or C:\Progra~1\Irfanv~1
Close Regedit and test by typing i_view32 in the Start Menu's Run field or in a command window.
*.reg file to save and Right-Click > Merge to registry is in the code snippet. Be sure to leave two blank lines after the last line in the file or the new values may not be written to the registry.
The other method uses Environment Variables. I can only vouch for this working in Windows XP.
Right-Click on My Computer and choose Properties. Open the Advanced tab and click the Environment Variables button. You will have two areas in the dialog: User and System. I suggest that you use the "user" field only.
If the "Path" variable exists, you can Double-Click on it to show the Variable Value field. If there are no entries in there already, just add the path to i_view32.exe as with the Regedit method above. If there is already a value or values in that field, then add the path to i_view32.exe on after placing a semicolon right after the last entry. No spaces between them.
I would prefer just to create a brand new user environment variable named eg. IrfanView and set the path for it to i_view32.exe.
Click OK to close the Environment Variables dialog, then click the "Apply" button on the System Properties dialog, and OK to close it. Test by typing irfanview in the tart Menu's Run field or at the command prompt.
Philip
I prefer Rugby to football, but even then I only watch if there's nothing else on. I was intrigued by the New Zealand All Blacks vs Wales on TV last night though. Those are some tough beasts of guys. Man, they smash each other around to the same degree as American Footballers ... but only wearing shorts and T shirts! Imagine facing guys the size of wardrobes doing this at you before the game:
http://files.allblacks.com
Hi John
I assume that you are referring to the revised batch file that I attached ("Crop-Convert-02-cmd.txt"
This batch file was written specifically for the one-off task of creating cropped images ONLY from a file named "activity.jpg" which must be 200 (pixels horiz) x 21000 (pixels vertical). It will NOT work if the image is a different size or if it has another name.
If you want to make it work on a file of another name, then you can either:
1. Rename your image to "activity.jpg"
OR
2. Open the batch file in Notepad (right-click > Edit) and use the Edit > Replace function (Ctrl + H) to FIND activity (Note: NOT "activity.jpg") and REPLACE WITH thefilename where "thefilename" is the name of the *.jpg image you want it to work with. Remember to do a File > Save to save the changes.
OR
3. Use my modified batch file "Crop-Convert-02-cmd.txt" which I will explain last in this comment.
Let me remind you about the requirements.
The batch can be run from ANY folder on ANY drive.
Your original "activity.jpg" image MUST be in the folder named: D:\boot\pics
If the image is not there, then the batch file is set to fail.
The batch file then creates the smaller cropped images from:
D:\boot\pics\activity.jpg
and names them "activity_1.jpg" to "activity_105.jpg".
These files are created in the same folder:
D:\boot\pics
You can change the path to your "activity.jpg" file by changing the 3rd line of the batch file you have been using to the path you want to use. So, you could change:
set ImgPath=D:\boot\pics
to:
set ImgPath=E:\Files for Cropping\200 x 21000 JPEGS\Activity\Original
or to whatever you wanted, as long as "activity.jpg" is in that last specified folder.
If you prefer, I have modified the batch file and will attach it below.
NEW BATCH FILE (Crop-Convert-03.cmd)
==========================
- Can be run from any folder (works in path with spaces in folder names)
- The image named in the set JpgName= must be in same folder as batch file.
(batch file will show error and prompt to quit if not)
- The file name of the image named in the set JpgName= can contain spaces.
- The destination folder is set in the DestPath= line of batch file.
If this folder path does not exists, it will be created.
Please leave the \%JpegName% part at the end of DestPath= line
as this is what gives the folder the same name as the large image file.
- The original large image file is copied to the new desination folder
where the batch file uses it to create the cropped images in that folder.
The original image file is then renamed to "__backup_%JpgName%.jpg".
This image is then copied as files named "%JpgName%_1.jpg"
up to "%JpgName%_105.jpg"
The original file is renamed as "__Original_%JpgName%.jpg"
- The batch file then tells Irfanview to crop "%JpgName%_1.jpg" to
"%JpgName%_105.jpg" and name the new cropped images as:
"_%JpgName%_1.jpg" through to "_%JpgName%_105.jpg"
The cpies of the original large images used are then deleted leaving
only the cropped images and the 2 backup files.
So, all you need to do is open the batch file in Notepad and edit the following two lines:
set JpgName=activity
set DestPath=D:\Cropped Images\%JpgName%
So, you could have something like this, where your image to be cropped is named: "MS Flag Starburst.jpg" and you want your cropped images in the folder: J:\IMAGES\My Cropped Images
set JpgName=MS Flag Starburst
set DestPath=J:\IMAGES\My Cropped Images\%JpgName%
The new folder for your cropped images would then be named:
J:\IMAGES\My Cropped Images\MS Flag Starburst
and the cropped images would be named:
"_MS Flag Starburst_1.jpg" through to "_MS Flag Starburst_105.jpg"
This has been tested ONLY in Windows XP.
I hope it answers what you need to know and do.
Bill
Business Accounts
Answer for Membership
by: felixjetPosted on 2009-11-06 at 16:42:45ID: 25764378
Try this :D http://www.blockposters.co m/
I hope it helps.