HEIC image format
HEIC image format
Hello,
Is there anything for reading and writing image in HEIC format?
I did not find it in the Purebasic help.
It's for updating my Purebasic generator of a HTML photo gallery. Some members of my family are beginning sending me HEIC image from their iPhone.
OK, I convert them to jpg in Windows, but a direct Purebasic solution would be better.
Thanks a lot.
Jean
Is there anything for reading and writing image in HEIC format?
I did not find it in the Purebasic help.
It's for updating my Purebasic generator of a HTML photo gallery. Some members of my family are beginning sending me HEIC image from their iPhone.
OK, I convert them to jpg in Windows, but a direct Purebasic solution would be better.
Thanks a lot.
Jean
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled
Re: HEIC image format
There is a free tool: https://www.copytrans.net/copytransheic/ that enables the windows photoviewer to view heif images.
PureBasic also can load then a thumbnail preview via CatchShellImage. Maybe someone can tell, how to load the full image?
PureBasic also can load then a thumbnail preview via CatchShellImage. Maybe someone can tell, how to load the full image?
Code: Select all
Procedure.l CatchShellImage ( file.s, ImgID.l ); Return ImgID.l
Protected Result = 0, ImageResult
Protected Desktop.IShellFolder, Folder.IShellFolder
Protected Extract.IExtractImage
Protected *pidlFolder.ITEMIDLIST, *pidlFile.ITEMIDLIST
Protected Priority, flags, Bitmap = 0, Size.SIZE
If SHGetDesktopFolder_(@Desktop) >= 0
If Desktop\ParseDisplayName(#Null, #Null, GetPathPart(file), #Null, @*pidlFolder, #Null) = #S_OK
If Desktop\BindToObject(*pidlFolder, #Null, ?IID_IShellFolder, @Folder) = #S_OK
If Folder\ParseDisplayName(#Null, #Null, GetFilePart(file) , #Null, @*pidlFile, #Null) = #S_OK
If Folder\GetUIObjectOf(#Null, 1, @*pidlFile, ?IID_IExtractImage, 0, @Extract) = #S_OK
Size\cx = ThumbSaveSize_X
Size\cy = ThumbSaveSize_Y
Depth = 24;#PB_Image_DisplayFormat
If Extract\GetLocation(Space(#MAX_PATH), #MAX_PATH, @Priority, @Size, Depth, @flags) = #S_OK
If Extract\Extract(@Bitmap) = #S_OK And Bitmap
If GetObject_ ( Bitmap, SizeOf(BITMAP), bm.BITMAP)
CreateImage ( ImgID, bm\bmWidth, bm\bmHeight, bm\bmBitsPixel )
hdc = StartDrawing( ImageOutput(ImgID))
If hdc
hdcNew = CreateCompatibleDC_(hdc)
If hdcNew
oldImage = SelectObject_(hdcNew, Bitmap)
BitBlt_(hdc, 0, 0, bm\bmWidth, bm\bmHeight, hdcNew, 0, 0, #SRCCOPY)
SelectObject_(hdcNew, oldImage)
DeleteDC_(hdc)
EndIf
StopDrawing ()
EndIf
success = #True
DeleteObject_(Bitmap)
EndIf
EndIf
EndIf
Extract\Release()
EndIf
CoTaskMemFree_(*pidlFile)
EndIf
Folder\Release()
EndIf
CoTaskMemFree_(*pidlFolder)
EndIf
Desktop\Release()
EndIf
ProcedureReturn success
DataSection
IID_IShellFolder: ; {000214E6-0000-0000-C000-000000000046}
Data.l $000214E6
Data.w $0000, $0000
Data.b $C0, $00, $00, $00, $00, $00, $00, $46
IID_IExtractImage: ; {BB2E617C-0920-11D1-9A0B-00C04FC2D6C1}
Data.l $BB2E617C
Data.w $0920, $11D1
Data.b $9A, $0B, $00, $C0, $4F, $C2, $D6, $C1
EndDataSection
EndProcedure
"Daddy, I'll run faster, then it is not so far..."
Re: HEIC image format
Hi CONVERT,
Recently there were a couple additions to Windows Services & Other Stuff\Other_Stuff\PowerShell\
- Convert_HEIC_JPEG\
-- To_HEIC\ToHEIC.pb
-- To_JPEG\ToJPEG.pb
Convert_HEIC / JPEG
https://github.com/DavidAnson/ConvertTo-Heic
https://github.com/DavidAnson/ConvertTo-Jpeg
Recently there were a couple additions to Windows Services & Other Stuff\Other_Stuff\PowerShell\
- Convert_HEIC_JPEG\
-- To_HEIC\ToHEIC.pb
-- To_JPEG\ToJPEG.pb
Convert_HEIC / JPEG
https://github.com/DavidAnson/ConvertTo-Heic
https://github.com/DavidAnson/ConvertTo-Jpeg
Last edited by JHPJHP on Fri Nov 12, 2021 2:58 pm, edited 1 time in total.
Re: HEIC image format
"Daddy, I'll run faster, then it is not so far..."
Re: HEIC image format
Hello JHPJHP,
Thanks a lot for your reply. It's very interesting, and a very good example of coding.
Check PM for more complete answer.
Thanks a lot for your reply. It's very interesting, and a very good example of coding.
Check PM for more complete answer.
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled
Re: HEIC image format
Thanks a lot, Dige.
Since this time, I replaced my Purebasic generator of a HTML photo gallery by a little, cheap commercial generator which gives me satisfaction, JuiceboxBuilder-Pro, still continued. It gives a good detection and adaptation of the different platforms and browsers, with easy finger manipulations on the smartphone.
But I keep your idea in case of JuiceboxBuilder-Pro discontinued.
Since this time, I replaced my Purebasic generator of a HTML photo gallery by a little, cheap commercial generator which gives me satisfaction, JuiceboxBuilder-Pro, still continued. It gives a good detection and adaptation of the different platforms and browsers, with easy finger manipulations on the smartphone.
But I keep your idea in case of JuiceboxBuilder-Pro discontinued.
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled
Re: HEIC image format
Why private message? Why not share the knowledge for all?
"Daddy, I'll run faster, then it is not so far..."
Re: HEIC image format
because it's more question of Powershell than Purebasic.
And about JuiceboxBuilder-Pro, I speak of it in another public post just before in this discussion.
Nevertheless, find below the private message I sent to JHPJHP:
But you can find these Powershells also in the JHPJHP's links given above in a public post:
And about JuiceboxBuilder-Pro, I speak of it in another public post just before in this discussion.
Nevertheless, find below the private message I sent to JHPJHP:
The Powershell is in an private post sent to me by JHPJHP. I prefer you ask to him.Sent: Fri Nov 12, 2021 13:14
by CONVERT
Hello JHPJHP, thanks a lot.
Your contribution is very interesting, especially about launching properly a Powershell script.
I thank you very much for solving this problem I submitted nearly 3 years ago.
Since this time, I replaced my Purebasic generator of a HTML photo gallery by a little, cheap commercial generator which gives me satisfaction, JuiceboxBuilder-Pro, still continued. It gives a good detection and adaptation of the different platforms and browsers, with easy finger manipulations on the smartphone.
I stopped coding in Powershell more than 3 years ago. At this time, I put at the beginning of the source instructions to treat error events, with the most severe control, something like:
$ErrorActionPreference = "Stop"
set-strictmode -version latest
And sometimes, before unpredictable instructions I wanted, I put
$ErrorActionPreference = "Continue"
And just after
$ErrorActionPreference = "Stop"
With this method, all the scripts became reliable, or stopped when a problem was encontered.
Your last contribution gives me a very good example for coding. Thank you very much.
But you can find these Powershells also in the JHPJHP's links given above in a public post:
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled
Re: HEIC image format
Thx CONVERT, I've also treid the powershell examples. They work well if the Copytrans extension is installed.
There is so little code in the scripts that I hoped I could somehow rewrite it for Purebasic. I discovered that the OCR solution presented here in the forum (the link above) works on the same technology. I would like to be able to load HEIC images with Purebasic. But I need help...
There is so little code in the scripts that I hoped I could somehow rewrite it for Purebasic. I discovered that the OCR solution presented here in the forum (the link above) works on the same technology. I would like to be able to load HEIC images with Purebasic. But I need help...
"Daddy, I'll run faster, then it is not so far..."
Re: HEIC image format
Of course this is possible. I have no time now to do it. I'll see it in a next few days.
Re: HEIC image format
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled
Re: HEIC image format
Hi dige
You can use ImageMagick convert.exe using PB
It's only 2 files you need [ convert.exe,delegates.xml]
Beside it's free and can convert any format to any format in no time
You can use ImageMagick convert.exe using PB
It's only 2 files you need [ convert.exe,delegates.xml]
Beside it's free and can convert any format to any format in no time
Egypt my love
Re: HEIC image format
Hi RASHAD, thanks for the tip with ImageMagick. I'll have to take a look at that.
+1
"Daddy, I'll run faster, then it is not so far..."
Re: HEIC image format
That code was removed. Please dont use it for production code. For a more robust solution see:
viewtopic.php?p=576884#p576884
For saving images, see help about SaveImage() and UseJPEGImageEncoder()
viewtopic.php?p=576884#p576884
For saving images, see help about SaveImage() and UseJPEGImageEncoder()
Last edited by acreis on Mon Nov 15, 2021 4:19 pm, edited 3 times in total.
Re: HEIC image format
I compiled it, it works fine.
Now, I'll try to understand the minimum to save the original image (not scaled 0.25) into jpeg format.
Thanks a lot, Acreis.
Now, I'll try to understand the minimum to save the original image (not scaled 0.25) into jpeg format.
Thanks a lot, Acreis.
PureBasic 6.01 LTS 64 bit | Windows 10 Pro x64 | Intel(R) Core(TM) i7-8700 CPU @ 3.20Ghz 16 GB RAM, SSD 500 GB, PC locally assembled