ConvertTo-Jpeg
A PowerShell script that converts RAW (and other) image files to the widely-supported JPEG format
Overview
Many cameras — and many phones — save photos in a custom file format.
Known as RAW images, these files contain richer information than the widely-supported JPEG format allows, but they are not as widely supported by tools.
To easily view, edit, or share pictures, it can be handy to convert RAW images to the JPEG format.
ConvertTo-Jpeg.ps1
is a PowerShell script that uses the Windows.Graphics.Imaging API to create a JPEG-encoded copy of each image that is passed to it.
(The original file is not modified.)
Related
- ConvertTo-Heic.ps1: A PowerShell script that converts image files to the efficient HEIC format
Examples
Converting Files
Passing parameters:
PS C:\T> .\ConvertTo-Jpeg.ps1 C:\T\Pictures\IMG_1234.HEIC C:\T\Pictures\IMG_5678.HEIC C:\T\Pictures\IMG_1234.HEIC -> IMG_1234.HEIC.jpg C:\T\Pictures\IMG_5678.HEIC -> IMG_5678.HEIC.jpg
Pipeline via dir
:
PS C:\T> dir C:\T\Pictures | .\ConvertTo-Jpeg.ps1 C:\T\Pictures\IMG_1234.HEIC -> IMG_1234.HEIC.jpg C:\T\Pictures\IMG_5678.HEIC -> IMG_5678.HEIC.jpg C:\T\Pictures\Kitten.jpg [Already JPEG] C:\T\Pictures\Notes.txt [Unsupported]
Pipeline via Get-ChildItem
:
PS C:\T> Get-ChildItem C:\T\Pictures -Filter *.HEIC | .\ConvertTo-Jpeg.ps1 C:\T\Pictures\IMG_1234.HEIC -> IMG_1234.HEIC.jpg C:\T\Pictures\IMG_5678.HEIC -> IMG_5678.HEIC.jpg
Renaming Files
Sometimes files have the wrong extension.
To rename JPEG-encoded files that don’t have the standard .jpg
extension, use the -FixExtensionIfJpeg
switch (alias -f
).
(The =>
in the output indicates that the file was renamed vs. converted.)
PS C:\T> dir C:\T\Pictures\*.HEIC | .\ConvertTo-Jpeg.ps1 -FixExtensionIfJpeg C:\T\Pictures\IMG_1234 (Edited).HEIC => IMG_1234 (Edited).jpg C:\T\Pictures\IMG_1234.HEIC -> IMG_1234.HEIC.jpg
Removing existing extensions
To remove the existing extension of a file, use the -RemoveOriginalExtension
switch (alias -r
).
PS C:\T> dir C:\T\Pictures\*.HEIC | .\ConvertTo-Jpeg.ps1 -RemoveOriginalExtension C:\T\Pictures\IMG_1234.HEIC -> IMG_1234.jpg C:\T\Pictures\IMG_5678.HEIC -> IMG_5678.jpg
Formats
Decoder | Extensions |
---|---|
BMP Decoder | .BMP .DIB .RLE |
CUR Decoder | .CUR |
DDS Decoder | .DDS |
DNG Decoder | .DNG |
GIF Decoder | .GIF |
ICO Decoder | .ICO .ICON |
JPEG Decoder | .EXIF .JFIF .JPE .JPEG .JPG |
Microsoft Camera Raw Decoder | .ARW .CR2 .CRW .DNG .ERF .KDC .MRW .NEF .NRW .ORF .PEF .RAF .RAW .RW2 .RWL .SR2 .SRW |
Microsoft HEIF Decoder | .AVCI .AVCS .HEIC .HEICS .HEIF .HEIFS |
Microsoft Webp Decoder | .WEBP |
PNG Decoder | .PNG |
TIFF Decoder | .TIF .TIFF |
WMPhoto Decoder | .JXR .WDP |
HEIC/HEIF
Windows 10’s April 2018 Update (version 1803) added support for HEIC/HEIF images to the Windows.Graphics.Imaging API.
ConvertTo-Jpeg.ps1
uses the new decoder automatically if it’s available.
To enable the decoder, install the Microsoft HEIF and HEVC Media Extensions bundle (or else both of HEVC Video Extensions and HEIF Image Extensions).
Once done, the built-in Photos app (and other programs that use the Windows.Graphics.Imaging API) will be able to open HEIC/HEIF images.
WEBP
If the default support for WebP images is missing or incomplete, consider installing the Microsoft Webp Image Extensions.
As above, the built-in Photos app is a great way to verify support for WEBP images.
We show you how to view a .heic file with the native Photos app, install and uninstall the HEIC extension, and use CopyTrans to convert HEIC format files.
Table of Contents:
At this point, those reading this article will likely be all too familiar with HEIC files. Apple’s image format of choice is designed to replace the humble .jpeg, but things begin to break down when trying to open a .heic file on a Windows 10 PC. Not to worry, we’re going to show you how to open HEIC files or convert to JPG, but first, we’ll talk a little about the format itself.
What is a HEIC file and why can’t I open it?
HEIC is the container for Apple’s Hight Efficiency Image Format (HEIF). It uses more modern and advanced compression methods to allow for better image quality than JPG in a smaller file size. It’s based on the HEVC (High Efficiency Video Compression) that newer iPhones and now various other file sharing sites now utilize.
On the surface, then, HEIC sounds like a no-brainer, but the problem with any new format is adoption and competition. Due to lack of adoption, iPhones automatically convert .heic files to .jpg when sharing them with Android or Windows users, but when transferred directly from the phone or via cloud storage they’re often unopenable by default.
Instead of thumbnails, Windows 10 users will see a default image icon and will be unable to open them. Thankfully, the Windows 10 April 2018 update made it easier to open HEIC format images by linking to a HEIC extension, which we’ll show you how to get now.
How to Open a HEIC File Natively via the Windows 10 HEIC Extension
When you try to open a HEIC file in Windows 10, Microsoft may inform you that you need to install codecs from the Windows Store to proceed. This isn’t strictly true, as you can use PowerShell (as shown below), but it is the easiest method.
- Get the HEIF Image Extension
You can find the HEIF Image Extension download here on the Microsoft Store. Click “Get” and wait for it to download and install.
- Check your HEIF image thumbnails
Head back to the folder with your HEIC file and you should see that its image thumbnail now appears in File Explorer and also in its preview pane.
- Open a HEIC file with File Explorer
You can now double-click any HEIC format file in File Explorer to open it as you would any other image. It will use the Photos app to do so.
How to Uninstall the HEIF Image Extension
If your HEIC file viewer is causing issues or you want to install a third-party software, you can uninstall it via PowerShell.
- Open PowerShell as an admin
Press “Windows + X” to open the context menu and choose “Windows PowerShell (Admin)”.
- Search for the HEIF extension
Check that the HEIF image extension is installed and get its package name with:
Get-AppxPackage *HEIF* -allusers
Note down its name and continue to the next step.
- Remove the HEIC file viewer with PowerShell
Type the following command and press “Enter” to remove your HEIC image extension.
Get-AppxPackage -allusers *HEIFImageExtension* | Remove-AppxPackage
The
-allusers
flag removes it for everyone on the PC. - OR automatically remove the HEIC viewer in Windows via CopyTransHEIC for Windows
Alternatively, run the CopyTrans HEIC installer from its official website to remove the extension without any commands. We’ll be showing you how to install and use the third-party software in the next section.
How to Convert HEIC to JPG with CopyTrans
Though Windows 10’s HEIC extension lets you view HEIC files painlessly, that’s only part of the struggle. What if you receive an image in the HEIC format on Windows and need to send it to other Windows users? It’s not ideal to ask them to install the extension each time, so the ability to convert HEIC to JPG in Windows 10 can be very useful.
There are a few tools to do this, including a simple webpage, but our testing has found the CopyTrans tool to be the most efficient due to its right-click context menu. It also lets you view HEIC files, replacing the Windows extension.
- Download and Install CopyTrans HEIC for Windows
If you haven’t already, grab CopyTrans HEIC for Windows from the official site by pressing the big blue “Download” button. Double-click the .exe file to start the installer and follow its instructions to install the program.
- How to convert HEIC to JPG with CopyTrans
Now that CopyTrans is installed, the thumbnails of all your HEIC format images should show in File Explorer, but you’ll have to take additional action if you want to convert HEIC to JPG in Windows 10. Thankfully, you can simply select them, right-click, and choose “Convert to JPEG with CopyTrans” to initiate the process.
- Check your folder for converted files
After a short period, you should see two files for each image in your folder, one larger image with the JPEG extension, and a smaller one that’s HEIC. You can keep both around or delete the original if you wish.
How to Convert HEIC to JPG, PNG, GIF, PSD and Other Formats with Windows, macOS or on the Web
Last Updated on November 8, 2024 12:58 pm CET
Ryan Maskellhttps://ryanmaskell.co.uk
Ryan has had a passion for gaming and technology since early childhood. Fusing the skills from his Creative Writing and Publishing degree with profound technical knowledge, he enjoys covering news about Microsoft. As an avid writer, he is also working on his debut novel.
|
—Образцы изображений для проверки можно взять здесь: https://filesamples.com/formats/heic Последний раз редактировалось: Ander_73 (2022-11-05 09:14), всего редактировалось 1 раз |
Отправлено: 16-Авг-2022 17:02
(спустя 1 час 38 минут)
Отправлено: 16-Авг-2022 17:02
(спустя 1 час 38 минут)
dimo70 |
_________________ |
Отправлено: 16-Авг-2022 17:39
(спустя 36 минут)
Отправлено: 16-Авг-2022 17:39
(спустя 36 минут)
Gvint64 |
|
Отправлено: 16-Авг-2022 17:44
(спустя 4 минуты)
Отправлено: 16-Авг-2022 17:44
(спустя 4 минуты)
Ander_73 |
96444
Paint картинку открывает. Я последнее время ставлю FastStone. Он себя ассоциирует сразу, а вот при открытии требует указанные в первой мессаге расширения. После их установки уже открывает без капризов. |
Отправлено: 16-Авг-2022 17:48
(спустя 3 минуты)
Отправлено: 16-Авг-2022 17:48
(спустя 3 минуты)
Gvint64 |
|
Отправлено: 16-Авг-2022 17:51
(спустя 2 минуты)
Отправлено: 16-Авг-2022 17:51
(спустя 2 минуты)
dimo70 |
_________________ |
Отправлено: 17-Авг-2022 11:02
(спустя 17 часов)
Отправлено: 17-Авг-2022 11:02
(спустя 17 часов)
Ander_73 |
|
Отправлено: 17-Авг-2022 19:40
(спустя 8 часов)
Отправлено: 17-Авг-2022 19:40
(спустя 8 часов)
dimo70 |
_________________ |
Отправлено: 17-Авг-2022 21:31
(спустя 1 час 50 минут)
Отправлено: 17-Авг-2022 21:31
(спустя 1 час 50 минут)
Ander_73 |
|
Отправлено: 17-Авг-2022 21:54
(спустя 23 минуты)
Отправлено: 17-Авг-2022 21:54
(спустя 23 минуты)
Отправлено: 17-Авг-2022 21:58
(спустя 4 минуты)
Отправлено: 17-Авг-2022 21:58
(спустя 4 минуты)
Ander_73 |
|
Отправлено: 18-Авг-2022 18:52
(спустя 20 часов)
Отправлено: 18-Авг-2022 18:52
(спустя 20 часов)
dimo70 |
_________________ |
Like most people, I take lots of photos.
Like many people, I save them in the highest-quality format (often RAW).
Like some people, I edit those pictures on a desktop computer.
Support for RAW images has gotten better over the years, but there are still many tools and programs that do not support these bespoke formats.
So it’s handy to have a quick and easy way to convert such photos into a widely-supported format like JPEG.
There are many tools to do so, but it’s hard to beat a command line script for simplicity and ease of use.
I didn’t know of one that met my criteria, so I wrote a PowerShell script:
ConvertTo-Jpeg —
A PowerShell script that converts RAW (and other) image files to the widely-supported JPEG format
Notes:
- This script uses the Windows.Graphics.Imaging API to decode and encode.
That API supports a variety of file formats and when new formats are added to the list, they are automatically recognized by the script.
Because the underlying implementation is maintained by the Windows team, it is fast and secure.- As it happens, support for a new format showed up in the days since I wrote this script: Windows 10’s April 2018 Update added support for HEIC/HEIF images such as those created by iPhones running iOS 11.
- The Windows.Graphics.Imaging API is intended for use by Universal Windows Platform (UWP) applications, but I am using it from PowerShell.
This is unfortunately harder than it should be, but allowed me to release a single script file which anybody can read and audit.- Transparency is not a goal for everyone, but it’s important to me — especially in today’s environment where malware is so prevalent.
I don’t trust random code on the Internet, so I prefer to use — and create — open implementations when possible.
- Transparency is not a goal for everyone, but it’s important to me — especially in today’s environment where malware is so prevalent.
- The choice of PowerShell had some drawbacks.
For one, it is not a language I work with often, so I spent more time looking things up than I normally do.
For another, it’s clear that interoperating with UWP APIs is not a core scenario for PowerShell.
In particular, calling asynchronous methods is tricky, and I did a lot of searching before I found a solution I liked: Using WinRT’s IAsyncOperation in PowerShell. - There are some obvious improvements that could be made, but I deliberately started simple and will add features if/when the need arises.
HEIC (High-Efficiency Image Container) is a modern image format commonly used by Apple devices to save space without compromising image quality. However, not all Windows applications and devices natively support HEIC files, making it necessary to convert them to a more universally compatible format like JPG.
This guide covers various methods for converting HEIC to JPG on Windows, including built-in features, online tools, and free software solutions.
- Compatibility: JPG files are widely supported across platforms and applications.
- Ease of Sharing: Ensure your images can be opened on all devices without additional software.
- Editing and Printing: Many editing tools and printers work better with JPG files.
Method 1: Using the Photos App on Windows
Windows 10 and 11 support HEIC files with the optional HEIF Image Extensions.
Step 1: Install HEIF and HEVC Extensions
- Open the Microsoft Store.
- Search for HEIF Image Extensions and HEVC Video Extensions.
- Install these extensions to enable HEIC support in Windows.
Step 2: Convert HEIC to JPG in the Photos App
- Open the HEIC file in the Photos app.
- Click the … menu (three dots) at the top-right corner.
- Select Save As and choose JPG as the file format.
- Save the file in your desired location.
Several websites allow you to upload HEIC files and convert them to JPG without installing software.
Recommended Online Tools
-
HEICtoJPG.com:
– Visit HEICtoJPG.com.
– Drag and drop your HEIC files into the converter.
– Download the converted JPG files. -
CloudConvert:
– Visit CloudConvert.
– Upload your HEIC files, select JPG as the output format, and start the conversion.
Note: Be cautious about uploading sensitive images to online services.
Method 3: Use Free Software
If you prefer offline solutions, use free software for batch conversions.
IrfanView
- Download IrfanView: Visit IrfanView’s official website and install the software.
- Install Plugins: Download the IrfanView plugin pack for extended file format support.
- Convert HEIC to JPG:
– Open the HEIC file in IrfanView.
– Go to File > Save As and select JPG as the format.
– Save the file.
CopyTrans HEIC for Windows
- Download CopyTrans HEIC: Visit CopyTrans and install the plugin.
- Convert HEIC to JPG:
– Right-click any HEIC file and select Convert to JPEG with CopyTrans.
– The converted file will be saved in the same location.
Method 4: Using PowerShell
Advanced users can use PowerShell scripts to convert HEIC to JPG if ImageMagick is installed.
-
Install ImageMagick:
– Download ImageMagick from ImageMagick.org. -
Run the Conversion Command:
powershell
magick convert input.heic output.jpg -
Replace
input.heic
with the source file name andoutput.jpg
with the desired output file name.
Comparison of Methods
Method | Ease of Use | Best For |
---|---|---|
Photos App | Easy | Quick single-file conversion |
Online Tools | Moderate | Lightweight, no installation required |
Free Software | Easy | Batch conversions and offline use |
PowerShell + ImageMagick | Advanced | Automation and scripting |
Pro Tips for Converting HEIC to JPG
- Batch Processing: Use tools like IrfanView or CopyTrans HEIC to convert multiple files at once.
- Preserve Quality: Adjust JPG quality settings in the converter to minimize compression artifacts.
- Backup Files: Keep a copy of your original HEIC files in case you need them later.
FAQs
Can I Convert HEIC to JPG Without Additional Software?
Yes, the Photos app on Windows can do this if you have the HEIF Image Extensions installed.
Does Converting HEIC to JPG Reduce Quality?
JPG is a compressed format, so there may be some loss of quality. Use high-quality conversion settings to minimize this.
Are Online Converters Safe?
Most reputable online converters are secure, but avoid uploading sensitive images to protect your privacy.
Conclusion
Converting HEIC to JPG on Windows is simple and can be done using built-in tools, online converters, or free software. Whether you need to convert a single file or process batches of images, there’s a solution for you.
Try these methods today and enjoy seamless compatibility with all your devices and applications!