Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #5071
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!pnx.dk!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Karl Wochele <kw@e﹐s-system.de> |
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: Shinking JPEGs |
| Date | Wed, 17 Apr 2013 09:49:49 +0200 |
| Lines | 159 |
| Message-ID | <at72gtFs5c3U2@mid.individual.net> (permalink) |
| References | <f55b1bdf-9f72-42f0-988e-8e1f41519d13@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net BYQ0U6YkSf7qMbAJzS20Nwjv3J/0DkHszjRiwJjyIcUvWy4YDq |
| Cancel-Lock | sha1:AKQEqHohkcuZXq6y60QAwcjHDkg= |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 |
| In-Reply-To | <f55b1bdf-9f72-42f0-988e-8e1f41519d13@googlegroups.com> |
| Xref | csiph.com comp.lang.clipper.visual-objects:5071 |
Show key headers only | View raw
Hi Kuno,
This might help you:
http://www.rw-designer.com/photo-resizer-advanced
Download Photoresize400.exe, then rename it to Photoresize.exe.
It is a command line tool which produces quite good quality.
You can use the following VO-Interface:
**************
STATIC DEFINE BUFSIZE := 1024
STATIC DEFINE RUN_TIMEOUT := 100
FUNCTION ResizeJpg(cInFile AS STRING,cOutFile AS STRING,nWidth AS
DWORD,nHeight AS DWORD) AS VOID PASCAL
LOCAL cRet AS STRING
LOCAL cCmd AS STRING
cCmd := "PhotoResize.exe "+"-h"+NTrim(nHeight)+" -q100 -n -m -o
-c"+cOutFile+" "+cInFile
RunPiped(cCmd,0,@cRet)
RETURN
FUNCTION RunPiped(cCmdLine AS STRING,nTimeout := 0 AS DWORD,cRet REF
STRING) AS LOGIC
LOCAL lOk AS LOGIC
LOCAL PipeReadHandle AS PTR
LOCAL PipeWriteHandle AS PTR
LOCAL StartupInfo IS _WINSTARTUPINFO
LOCAL ProcessInfo IS _WINPROCESS_INFORMATION
LOCAL SecurityAttributes IS _WINSECURITY_ATTRIBUTES
LOCAL nWait AS DWORD
LOCAL dwExit AS DWORD
LOCAL nRead AS DWORD
LOCAL nAvail AS DWORD
LOCAL nRest AS DWORD
LOCAL pBuff AS PSZ
MemSet(@StartupInfo,0,_SIZEOF(_WINSTARTUPINFO))
MemSet(@ProcessInfo,0,_SIZEOF(_WINPROCESS_INFORMATION))
MemSet(@SecurityAttributes,0,_SIZEOF(_WINSECURITY_ATTRIBUTES))
SecurityAttributes.nLength := _SIZEOF(_WINSECURITY_ATTRIBUTES)
SecurityAttributes.lpSecurityDescriptor := NULL_PTR
SecurityAttributes.bInheritHandle := TRUE
BEGIN SEQUENCE
IF !CreatePipe(@PipeReadHandle,@PipeWriteHandle,@SecurityAttributes,0)
cRet := "Fehler beim Erstellen der Pipe!"
BREAK
ENDIF
StartupInfo.cb := _SIZEOF(_WINSTARTUPINFO)
StartupInfo.dwFlags := _OR(STARTF_USESHOWWINDOW,STARTF_USESTDHANDLES)
StartupInfo.wShowWindow := SW_HIDE
StartupInfo.hStdInput := GetStdHandle(STD_INPUT_HANDLE)
StartupInfo.hStdOutput := PipeWriteHandle
StartupInfo.hStdError := PipeWriteHandle
IF !CreateProcess( NULL_PSZ,;
String2Psz(cCmdLine),;
NULL,;
NULL,;
TRUE,;
0,;
NULL,;
NULL_PSZ,;
@StartupInfo,;
@ProcessInfo )
cRet := "Fehler beim Starten des Prozesses!"
BREAK
ENDIF
lOk := TRUE
IF GetExitCodeProcess(ProcessInfo.hProcess,@dwExit)
nWait := 0
WHILE(dwExit=STILL_ACTIVE)
nWait += RUN_TIMEOUT
IF nWait > nTimeout .AND. nTimeout > 0
TerminateProcess(ProcessInfo.hProcess,5333)
lOk := FALSE
EXIT
ENDIF
Sleep(RUN_TIMEOUT)
GetExitCodeProcess(ProcessInfo.hProcess,@dwExit)
ENDDO
ENDIF
CloseHandle(PipeWriteHandle)
PipeWriteHandle := NULL_PTR
cRet := ""
WHILE(TRUE)
pBuff := MemAlloc(BUFSIZE)
PeekNamedPipe( PipeReadHandle,;
pBuff,;
BUFSIZE,;
@nRead,;
@nAvail,;
@nRest)
IF nRead > 0
ReadFile(PipeReadHandle,pBuff,BUFSIZE,@nRead,NULL_PTR)
cRet += Psz2String(pBuff)
ENDIF
MemFree(pBuff)
IF nRead = 0
EXIT
ENDIF
ENDDO
CloseHandle(ProcessInfo.hThread)
CloseHandle(ProcessInfo.hProcess)
lOk := TRUE
END SEQUENCE
IF PipeReadHandle <> NULL_PTR
CloseHandle(PipeReadHandle)
ENDIF
IF PipeWriteHandle <> NULL_PTR
CloseHandle(PipeWriteHandle)
ENDIF
RETURN lOk
**************
HTH
Karl
Am 03.04.2013 21:21, schrieb Kuno Egger:
> I need to reduce the size of jpg photos for upload to a web shop. I am trying to use FabPaint but have not hit on the right way to do it.
>
> I can use FabPaint to display large jpg photos (see code) but not save them as smaller files.
>
> Any advice would be greatly appreciated.
>
> ----------------------------------------------
>
> SELF:oDCPict:Image := FabPaintLib{ cFileName }
> nWidth := SELF:oDCPict:Image:width
> nHeight := SELF:oDCPict:Image:height
> IF nWidth > 411 .OR. nHeight > 284
> DO WHILE nWidth > 411 .OR. nHeight > 284
> IF Integer(nWidth * .6) < 411
> nWidth := Integer(nWidth * .99)
> nHeight := Integer(nHeight * .99)
> ELSE
> nWidth := Integer(nWidth * .6)
> nHeight := Integer(nHeight * .6)
> ENDIF
> ENDDO
> SELF:oDCPict:Image:ResizeBox( nWidth, nHeight, 1 )
> ENDIF
> SELF:oDCPict:show()
>
>
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Find similar | Unroll thread
Shinking JPEGs Kuno Egger <kuno@retailsoftware.com> - 2013-04-03 12:21 -0700
Re: Shinking JPEGs "Jamal" <jamal@examples.net> - 2013-04-03 16:48 -0400
Re: Shinking JPEGs Fabrice Foray <fabrice.foray@gmail.com> - 2013-04-03 13:53 -0700
Re: Shinking JPEGs Kuno Egger <kuno@retailsoftware.com> - 2013-04-04 10:04 -0700
Re: Shinking JPEGs Fabrice Foray <fabrice.foray@gmail.com> - 2013-04-04 13:50 -0700
Re: Shinking JPEGs Kuno Egger <kuno@retailsoftware.com> - 2013-04-04 15:10 -0700
Re: Shinking JPEGs Paulo Oliveira <paulo@clipinfor.com> - 2013-04-05 02:29 -0700
Re: Shinking JPEGs Fabrice Foray <fabrice.foray@gmail.com> - 2013-04-06 02:28 -0700
Re: Shinking JPEGs "Wolfgang Riedmann" <wriedmann@gmail.com> - 2013-04-04 07:36 +0200
Re: Shinking JPEGs Sherlock <sherlock@sherlock.com.au> - 2013-04-04 08:11 -0700
Re: Shinking JPEGs Kuno Egger <kuno@retailsoftware.com> - 2013-04-04 10:08 -0700
Re: Shinking JPEGs Karl Wochele <kw@e©os-system.de> - 2013-04-17 09:49 +0200
csiph-web