Page 1 of 1

WIA.scanner output PNG ¿Possible?

Posted: Wed Mar 01, 2017 7:59 pm
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"

Re: WIA.scanner output PNG ¿Possible?

Posted: Thu Mar 02, 2017 1:01 am
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.

Re: WIA.scanner output PNG ¿Possible?

Posted: Thu Mar 02, 2017 5:45 pm
by milor
The above code does not work... wiaFormatBMP or wiaFormatPNG or wiaFormatJPG

FilterID -> The method or property was not found

:crazy:

Re: WIA.scanner output PNG ¿Possible?

Posted: Thu Mar 02, 2017 6:14 pm
by JeJe
Its not really an OpenOffice question, you might be able to get more help with it here:

http://www.vbforums.com/

Re: WIA.scanner output PNG ¿Possible?

Posted: Thu Mar 02, 2017 6:43 pm
by milor
It's for an openffice macro oÓ

Re: WIA.scanner output PNG ¿Possible?

Posted: Thu Mar 02, 2017 9:42 pm
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.