• Stars
    star
    188
  • Rank 205,563 (Top 5 %)
  • Language
    PowerShell
  • License
    MIT License
  • Created over 6 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A PowerShell script that converts RAW (and other) image files to the widely-supported JPEG format

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. (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

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.

More Repositories

1

markdownlint

A Node.js style checker and lint tool for Markdown/CommonMark files.
JavaScript
4,770
star
2

vscode-markdownlint

Markdown linting and style checking for Visual Studio Code
JavaScript
934
star
3

markdownlint-cli2

A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library
JavaScript
348
star
4

markdownlint-cli2-action

A GitHub Action to run the markdownlint-cli2 tool for linting Markdown/CommonMark files with the markdownlint library
JavaScript
92
star
5

DHCPLite

A small, simple, configuration-free DHCP server for Windows.
C++
52
star
6

ConvertTo-Heic

A PowerShell script that converts image files to the efficient HEIC format
PowerShell
47
star
7

PassWeb

A simple, secure, cloud-based password manager.
JavaScript
26
star
8

math-random-polyfill

A browser-based polyfill for JavaScript's Math.random() that tries to make it more random
JavaScript
23
star
9

live-photo-web

Live Photos via Web Components
JavaScript
19
star
10

Twitter-Alternatives

A Practical Comparison of Mastodon and Micro.blog
14
star
11

simple-website-with-blog

A simple website with a blog
JavaScript
13
star
12

update-ios-contact-images

A Scriptable (https://scriptable.app/) script to update Contact photos on iOS
JavaScript
12
star
13

check-pages

Checks various aspects of a web page for correctness.
JavaScript
11
star
14

grunt-check-pages

Grunt task that checks various aspects of a web page for correctness.
JavaScript
11
star
15

MouseButtonClicker

MouseButtonClicker clicks the mouse so you don't have to!
C++
10
star
16

StringExtractors

A collection of simple command-line utilities to extract strings and comments from source code
JavaScript
9
star
17

crc-hash

A Node.js Crypto Hash (Stream) implementation for the CRC algorithm.
JavaScript
6
star
18

azure-blob-container-download

A simple, cross-platform tool to bulk-download blobs from an Azure storage container.
JavaScript
5
star
19

CoLR

Camera of Last Resort - Possibly worse than no camera at all...
JavaScript
3
star
20

gruntMock

A simple mock for testing Grunt multi-tasks.
JavaScript
3
star
21

Workflows

Various Workflows for running GitHub Actions
JavaScript
3
star
22

check-pages-cli

Checks various aspects of a web page for correctness.
JavaScript
2
star
23

Utilities

Bits of code I use for stuff
JavaScript
2
star
24

Lenz

A simple, cross-platform app for reviewing photos and picking favorites.
JavaScript
2
star
25

tape-player

A simple, terse, in-process reporter for the tape test runner for Node.js.
JavaScript
2
star
26

SpellV

A simple app that makes it easy to spell-check with a browser.
JavaScript
1
star
27

generateRandomUUID

JavaScript code to efficiently generate a random (version 4) UUID per RFC 4122
HTML
1
star
28

promise-ring

Convenience methods for converting Node.js callbacks into native Promises.
JavaScript
1
star
29

npm-placeholder

This is a placeholder package to prevent name-squatting in the npm package registry.
1
star
30

markdownlint-analyze-config

Code to analyze markdownlint config in the wild
JavaScript
1
star
31

static-web-app

Source repository containing files of a static web app for experimentation and testing.
JavaScript
1
star