PSD view?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Elaphe666
Posts: 131
Joined: 28 Nov 2015, 11:39

PSD view?

05 Sep 2020, 02:19

Do you know any way to make possible the display of .psd (Photoshop) images with a gui in Autohotkey?
User avatar
mikeyww
Posts: 26848
Joined: 09 Sep 2014, 18:38

Re: PSD view?

05 Sep 2020, 13:20

ImageMagick

Code: Select all

; AutoHotkey script to display a Photoshop image
; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=80676
; Get convert.exe from https://imagemagick.org/script/download.php
source = [pathToPhotoshopFile]
If !FileExist(source) {
 MsgBox, File '%source%' was not found. Aborting.
 ExitApp
}
SplitPath, source,,, ext, fnBare
If ext not in ani,bmp,cpl,cur,dll,exe,gif,ico,jpg,png,scr,tif
{
 SplashTextOn, 300, 100, Converting image...., Please wait....
 target = %TEMP%\%fnBare%.png
 FileRecycle, %target%
 RunWait, [pathToConvert]\convert.exe %source% %target%,, Min
 SplashTextOff
} Else target := source
If FileExist(target) {
 Gui, Add, Picture,, %target%
 Gui, Show,, %source% (ESC = Exit)
} Else MsgBox, File '%target%' was not found.
Return

GuiClose:
GuiEscape:
If (target != source)
 FileRecycle, %target%
ExitApp
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: PSD view?

06 Sep 2020, 00:59

DevIL

Code: Select all

SetWorkingDir %A_ScriptDir%

hBitmap := DevIL_FileToHBitmap("test.psd")
Gui, Add, Pic, , HBITMAP:%hBitmap%
Gui, Show
Return

; Requires DevIL.dll, ILU.dll, ILUT.dll
; from http://openil.sourceforge.net/
DevIL_FileToHBitmap(Filename)
{
	hModule := DllCall("LoadLibrary", "str", "DevIL.dll", "ptr")
	DllCall("DevIL\ilInit")

	hDC := DllCall("GetDC", "ptr", 0, "ptr")
	hBitmap := DllCall("ILUT\ilutWinLoadImage", "str", Filename, "ptr", hDC, "ptr")
	
	DllCall("ReleaseDC", "ptr", 0, "ptr", hDC)
	DllCall("DevIL\ilShutDown")
	DllCall("FreeLibrary", "ptr", hModule)
	return hBitmap
}

GuiClose() {
	ExitApp
}
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: PSD view?

06 Sep 2020, 07:10

Just for the records, :arrow: this PhotoShop Scripting Guide has been recommended here from 'Pierre Chiggles'.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mamo691, MrDoge and 241 guests