Page 1 of 1

HELP - testing script - Guides to slices

PostPosted: Thu Feb 14, 2019 9:52 am
by LeviFiction

I've created a script that reads a PSPImage to find all of the guides. I figure being able to do this would be helpful for any number of reasons. But, very specifically, this script uses guides to create cell slices of an image.

But I need some help.

I encountered one image, for reasons I cannot explain, that failed no matter what I tried. Then PSP crashed before I could save it to examine the file. Subsequent tests did not show the same error. Which has me perpelexed. I can't figure it out. So I was wondering if people would be willing to test the script and see if they can find an image that will cause the script to give an error?

Requirements: The script must be installed in the Scripts-Trusted folder as it accesses files on your harddrive, saves images, and access python libraries.

Video Demo of Script: ... atXYg/view

Script Download: ... JnCfrXdZVl

Re: HELP - testing script - Guides to slices

PostPosted: Fri Feb 15, 2019 2:26 am
by cosmicDread
Hi Levi,

This was my first experience using Guides, so I had to look at the help file to figure out how to use them. The learning curve was short, and was I was able to find three short-comings in your code.

In the function 'getParts',
line #238 reads,
if len(guides) > 1:

which fails if there is only one guide.

(2): If there are no horizontal guides or no vertical guides, the code fails.

(3): If guides are off the grid or have been removed, then the code fails. It looks like PSP keeps these fields in the data block, but their coordinates are off the grid.

I made a few changes to your code and posted the file as an attachment.

This is a great script. I had no idea one could do such things with PSP. :D

Hopeful that this helps,
(3.16 KiB) Downloaded 23 times

Re: HELP - testing script - Guides to slices

PostPosted: Sat Feb 16, 2019 1:31 am
by LeviFiction
Thank you very much, I shall examine your changes carefully.