WIA.scanner output PNG ¿Possible?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
milor
Posts: 9
Joined: Wed Mar 01, 2017 7:52 pm

WIA.scanner output PNG ¿Possible?

Post by milor »

Excuse my level of English, I saw the following message:
viewtopic.php?f=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

¨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
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: WIA.scanner output PNG ¿Possible?

Post by JeJe »

Try changing wiaFormatJPEG to wiaFormatPNG.

Format constants are here:

https://msdn.microsoft.com/en-us/librar ... s.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.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
milor
Posts: 9
Joined: Wed Mar 01, 2017 7:52 pm

Re: WIA.scanner output PNG ¿Possible?

Post by milor »

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
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: WIA.scanner output PNG ¿Possible?

Post by JeJe »

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

http://www.vbforums.com/
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
milor
Posts: 9
Joined: Wed Mar 01, 2017 7:52 pm

Re: WIA.scanner output PNG ¿Possible?

Post by milor »

It's for an openffice macro oÓ
Libreoffice on 5.3.0.3 on Windows 10
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: WIA.scanner output PNG ¿Possible?

Post by JeJe »

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.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Post Reply