WIA.scanner output PNG ¿Possible?

Creating a macro - Writing a Script - Using the API

WIA.scanner output PNG ¿Possible?

Postby milor » Wed Mar 01, 2017 7:59 pm

Excuse my level of English, I saw the following message:
https://forum.openoffice.org/en/forum/v ... 20&t=43854
It works fine, but the file is a BMP and needs a PNG. Is it possible?


This code not run :(
Code: Select all   Expand viewCollapse view
¨Dim Img 'As ImageFile
Dim IP 'As ImageProcess

Set Img = CreateObject("WIA.ImageFile")
Set IP = CreateObject("WIA.ImageProcess")

Img.LoadFile "C:\WINDOWS\Web\Wallpaper\Bliss.bmp"

IP.Filters.Add IP.FilterInfos("Convert").FilterID
IP.Filters(1).Properties("FormatID").Value = wiaFormatJPEG
IP.Filters(1).Properties("Quality").Value = 5

Set Img = IP.Apply(Img)

Img.SaveFile "C:\WINDOWS\Web\Wallpaper\BlissCompressed.jpg"
Libreoffice on 5.3.0.3 on Windows 10
milor
 
Posts: 9
Joined: Wed Mar 01, 2017 7:52 pm

Re: WIA.scanner output PNG ¿Possible?

Postby JeJe » Thu Mar 02, 2017 1:01 am

Try changing wiaFormatJPEG to wiaFormatPNG.

Format constants are here:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms630810(v=vs.85).aspx

don't know what you'd change the "quality" value to - you could try it as it is or try omitting that line altogether to see what happens.
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 114
Joined: Wed Mar 09, 2016 2:40 pm

Re: WIA.scanner output PNG ¿Possible?

Postby milor » Thu Mar 02, 2017 5:45 pm

The above code does not work... wiaFormatBMP or wiaFormatPNG or wiaFormatJPG

FilterID -> The method or property was not found

:crazy:
Libreoffice on 5.3.0.3 on Windows 10
milor
 
Posts: 9
Joined: Wed Mar 01, 2017 7:52 pm

Re: WIA.scanner output PNG ¿Possible?

Postby JeJe » Thu Mar 02, 2017 6:14 pm

Its not really an OpenOffice question, you might be able to get more help with it here:

http://www.vbforums.com/
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 114
Joined: Wed Mar 09, 2016 2:40 pm

Re: WIA.scanner output PNG ¿Possible?

Postby milor » Thu Mar 02, 2017 6:43 pm

It's for an openffice macro oÓ
Libreoffice on 5.3.0.3 on Windows 10
milor
 
Posts: 9
Joined: Wed Mar 01, 2017 7:52 pm

Re: WIA.scanner output PNG ¿Possible?

Postby JeJe » Thu Mar 02, 2017 9:42 pm

I can't test your code - I don't have a scanner. No-one else has replied.

Your code is Windows stuff. I've given you another forum where you might find the answer. Post there - or don't try there - its up to you. Its the best help I can be.
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 114
Joined: Wed Mar 09, 2016 2:40 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests