Do we have anything close to Ps StockSolo and Icons8?

Corel Paint Shop Pro

Moderator: Kathy_9

LeviFiction
Advisor
Posts: 5984
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8, 9, X, XI, X2, X8,X9, 2018, 2019
Location: USA

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by LeviFiction »

No we cannot use any compiled libraries, only pure Python libraries are guaranteed to work in PSP. This is because those compiled rely on the original Python27.dll file and PSP compiled their own CorePython27.dll. And if they don't match it's a ##### to make it work. Technically, if you know how, you can compile a custom version of Pillow to use the CorePython27.dll. Most of it is the same. Not being up on how C++ compilation works or how to make my own Python compiled libraries I'm useless in this area. I did at one point have a slight workaround, it involved renaming the CorePython27.dll to something else. Then setting up a hardlink file named CorePython.dll and pointed to the original Python27.dll. This did work for loading other libraries but was unstable as the directories didn't quite match.

Also it wasn't something I could expect a regular user to do.

I should note that PSP's python engine can use the Ctypes library which includes a lot of the necessary tools for loading in generic dlls and working with memory items using classes that simulate C structs. Using this is how I get my scripts to talk to the Windows Clipboard as it calls those basic Wind32 apis just fine. So another option would be to create a generic image managing library (or use OpenCV which PSP currently makes use of) and working out the specifics of getting Python to work with the images.

This is why I wanted to use a separate program. Nothing for the user to understand. It would be almost like a regular plugin.

Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS You're just making a website that runs like a regular windows program, essentially. VisualStudio Code is made using Electron. That's why it looked so neat, because the web browser does all of the hard work for you.

There are several different possible methods of sending images to PSP. First, for some of these sites, you don't get access to the full image unless you can prove your App follows some strict guidelines. Like pixabay requires that you cache your searches and results for at least 24 hours. Without being able to demonstrate that you only get a scaled version of the image and it will be limited in how many requests the API key can make. So, yes it can download the images. I realize I can make it extremely simple and just call PSP but I wanted to make it more server/client -esque. With PSP actively responding to specific requests. Like "Load as Layer" and "Create Mask" "Load as new image" As well as being able to handle multiple copies of PSP being open at the same time. Tried an XMLRPC server setup, which mostly worked. But ran into a very odd Endless loop that broke it. Next idea was a temporarly file location where the images would be saved along with an instruction file. And just have PSP request the contents of that location until the instruction file told it to quit.

I also need to work out paging of the image results, and how to best search each of the different services. Do I use tabs? Or have them all on a single page put into blocks?

I also haven't worked on it at all in the past week, other things going on.
Last edited by LeviFiction on Sun Mar 28, 2021 7:40 pm, edited 1 time in total.
LeviFiction
Advisor
Posts: 5984
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8, 9, X, XI, X2, X8,X9, 2018, 2019
Location: USA

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by LeviFiction »

On the commandline option, i should point out that it is possible to open an image with the scriptlet command-line option. This runs a script on the image that was passed in. It's meant to be used with the Shortcut icon on the desktop. Just drag an image onto the shortcut and it auto-executes the script. I've never tried it using the commandline from another app into an already open version of PSP. It is something to look into as the script can handle the moving the file to another image. It would be annoying though if you already had more than one image open.

Scriptlets are simple enough to use the paremter is "/Script" with the full path to the script.

C:\program files\Corel\Corel Paint Shop Pro 2021\Corel PaintShop Pro.exe "ImagePath" /Script "ScriptPath"
migf1
Posts: 485
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by migf1 »

I start thinking that all this is way too overwhelming after all. I mean this should be really done by Corel themselves as a core part of PSP. Affinity Photo has it (calls it Stock), Ps has those free extensions (just came across another one just for pixabay) and PSP has nothing.

Anyway, looking at your demo (especially after seeing the presence of the "Send to PSP" buttons) I thought you had already done the results pagination, but since you say you haven't, I guess it was some kind of dumping the resulting webpage into a widget or something.

If you are gonna make it anyway, I wouldn't worry about combining results from multiple sites. They could be options in a dropdown menu, targeting just one site at a time. The API restrictions is indeed an issue, I did have a very shallow look at a couple of those (I think unsplash and pexels) and they were both limited to 5000 searches per hour. That's more than fine for just 1 user, but could be an issue if the plugin gets really popular (don't know how those Ps extensions deal with that). Also I had no idea about pixabay's requirement to cache the searches & results for 24 hours. Well, i guess pixabay could be left out of the supported sites list.

I wouldn't worry about supporting multiple versions of PSP being currently open.

Regarding "Load as Layer", "Create Mask" "Load as new image" I think once the user-selected image has been downloaded to a temp location by the utility app, and then opened inside PSP from the script as a new image, the users can easily do whatever they want with it (including copying it to the clipboard).

I realize there must be some kind of a messaging protocol between the utility app and the script, probably using a temp file created by the app and read by the script (probably wrapped with a timer), just for opening the temp image into PSP, much more for implementing options like "as new image", "as new layer", etc. But does it really worth all that effort? I mean, imo it's on Corel to provide a full-blown option for Stock searches (or at the very least, enhance their scripting capabilities with modern easy to use web libraries so people can properly implement things like that.

I would simply have the utility app "starting" PSP, passing it the temp saved image as a command-line argument, and then delete the temp image from the hard-disk. And then leave it to the users to decide what to do with the opened image inside PSP.

EDIT:
PS. Question: is python capable of producing stand-alone executables which would run on users system's without needing python installed from their part?
Seems like it's possible: https://stackoverflow.com/questions/545 ... y-dependen
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
migf1
Posts: 485
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by migf1 »

migf1 wrote:
Mon Mar 29, 2021 1:18 pm
[snip]
I wouldn't worry about supporting multiple versions of PSP being currently open.
[snip]
Hmm, on a 2nd thought, "starting" PSP from the app does need a way of knowing where PSP's executable full pathname is located. I guess the easiest way is to let user specify that once in the app, via file selector dialog, unless there is an easy way to detect if any PSP version is currently opened, and then let the users decide which one they want to send the image to (or even to more than one, if more than 1 is detected)
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
LeviFiction
Advisor
Posts: 5984
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8, 9, X, XI, X2, X8,X9, 2018, 2019
Location: USA

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by LeviFiction »

I prefer pyInstaller for creating a python executable. Though cx_freeze is also good. The biggest issue is sometimes you have to have a separate version for each supported version of Windows.

I once made a PDF merge executable for work but because I made it on Windows 10 it wouldn't work on the older Windows 7 computer the recipient was working on.
migf1
Posts: 485
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by migf1 »

Was thinking of trying to make a standalone python/tkinter exe doing the job, mostly for practicing tbh... I'll have a look at that 3rd party web widget too, though my main concern is 2-fold:
a) displaying the search results without needing to list them all at once
b) getting the user selection from the displayed results

The unsplash API returns a json string, so I guess I can't avoid having it in the memory, but for displaying them my 1st thought is to have say a Listbox widget (or whatever is more suitable) displaying a finite number of entries (photo thumbnails), and then map the scrolling to the json dict.

For example, if the listbox is set to display say 10 entries and the user fires a scrolling operation, the app will get the requested entries from the json dict and put them in the lisbox. This way the app will have at any given time just 10 listbox entry widgets for displaying results, instead of hundreds or thousands. However, this kind of mapping is easier said than done. If there is an easier way, please let me know.
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
migf1
Posts: 485
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by migf1 »

migf1 wrote:
Mon Mar 29, 2021 3:42 pm
migf1 wrote:
Mon Mar 29, 2021 1:18 pm
[snip]
I wouldn't worry about supporting multiple versions of PSP being currently open.
[snip]
Hmm, on a 2nd thought, "starting" PSP from the app does need a way of knowing where PSP's executable full pathname is located. I guess the easiest way is to let user specify that once in the app, via file selector dialog, unless there is an easy way to detect if any PSP version is currently opened, and then let the users decide which one they want to send the image to (or even to more than one, if more than 1 is detected)
I did some research regarding the piece I marked with red above, and came across the psutil python module.
It makes it easy to get the full pathname of a running process.

Tested it with Python 3.8.5:

Code: Select all

import psutil
def find_name_in_processes( name ):
    lst = []
    for proc in psutil.process_iter(['pid', 'name', 'exe']):
        if name.lower() in proc.info['name'].lower():
            lst.append(proc.info)
        #print(proc.info)
    return lst

pspProcList = find_name_in_processes( "Corel PaintShop Pro" )
if not pspProcList:
    print( "PSP is not currently running" )
else:
    for l in pspProcList:
        print( l['exe'] )
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
migf1
Posts: 485
Joined: Fri Apr 03, 2020 3:09 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit

Re: Do we have anything close to Ps StockSolo and Icons8?

Post by migf1 »

LeviFiction wrote:
Mon Mar 29, 2021 3:49 pm
I prefer pyInstaller for creating a python executable. Though cx_freeze is also good. The biggest issue is sometimes you have to have a separate version for each supported version of Windows.

I once made a PDF merge executable for work but because I made it on Windows 10 it wouldn't work on the older Windows 7 computer the recipient was working on.
I gave pyInstaller a really quick-go and it actually failed. Probably cause I'm using a ton of import modules. I did have a quick look at its docs, and I saw it has options for displaying logs, but I didn't try them. I didn't try cx-freeze either yet. I'll have a detailed look when the time comes, because atm I'm still experimenting with python and tkinter.

I may ask for your help Levi if I can't manage it.

In the meantime, here is a brief video of how it looks so far, and obviously with a ton of work ahead (I just got a Pexels API Key btw, which I haven't used yet). I'm not using real data, I just made an emulated Pexels json-pages pool with just 1 photo repeating over and over in 15 pages with 30 "pics" per page

It can take me months before I actually finish it, since I do it in my spare time. But you're right Levi, a web-framework instead of python & tkinter would most probably make things so much easier. Pagination for example is a real b*tch LOL

But it's ok, I've always wanted to get my heads a bit dirty with python, so I'm not complaining. I'm just having some fun (I do like Tkinter after all, despite its shortcomings)

Ok this is a very early draft: https://www.youtube.com/watch?v=yHt7Sl_m-No
Good Unofficial PaintShop Pro Tutorials: Creation CasselMake Shop ProHEC Image EditingLeviFiction PSP Basics
(plus my own Gimp & Stuff)
Post Reply