fredmiranda.com
Login

Moderated by: Fred Miranda
  New fredmiranda.com Mobile Site
  New Feature: SMS Notification alert
  New Feature: Buy & Sell Watchlist
  

FM Forums | Nikon Forum | Join Upload & Sell

  

img2nef - convert any image into a NIkon NEF raw

  
 
snapsy
Offline
• • • • • •
Upload & Sell: On
p.1 #1 · img2nef - convert any image into a NIkon NEF raw


I've published my open-source img2nef utility, which converts any image file into a Nikon NEF lossless raw. The NEF can be used anywhere NEFs are supported, including in the camera itself. Here is the GitHub project page:

https://github.com/horshack-dpreview/img2nef

This is the code I wrote as part of my Nikon C2PA signing exploit (Dpreview article and Follow-up article).

The utility runs on Windows, Mac, and Linux.

In addition to scientific/technical uses there are some practical applications as well. For example, Nikon MILCs have a multiple exposure feature that lets you specify an existing NEF as the first image of the composite. Normally the existing NEF would be an image taken with the camera but with img2nef you can use any image converted into a NEF, including computer-generated and AI images. Outside of the creative possibilities you can use this feature to create custom viewfinder overlays (ie, custom aspect ratio framing guides and/or display grids), where the "first" NEF of the composite is the overlay you create. This is because Nikon's feature lets you view the first NEF as an overlay while you're shooting, again as if you were creating a composite image.

I still need template NEFs for some models. Please see this thread to see if you can contribute:

https://www.fredmiranda.com/forum/topic/1921657/

To make it easy to create and use overlays I've written a utility named 'createoverlay' that lets you create any combination of aspect ratio framing guides and grid layouts as a PNG and then automatically convert that into an NEF for use in the camera. The documentation on my GitHub has all the details on how to use and apply these overlays. Here is a quick video showing an overlay in use:

In addition to scientific/technical uses there are some practical applications as well. For example, Nikon MILCs have a multiple exposure feature that lets you specify an existing NEF as the first image of the composite. Normally the existing NEF would be an image taken with the camera but with img2nef you can use any image converted into a NEF, including computer-generated and AI images. Outside of the creative possibilities you can use this feature to create custom viewfinder overlays (ie, custom aspect ratio framing guides and/or display grids), where the "first" NEF of the composite is the overlay you create. This is because Nikon's feature lets you view the first NEF as an overlay while you're shooting, again as if you were creating a composite image.

To make it easy to create and use overlays I've written a utility named 'createoverlay' that lets you create any combination of aspect ratio framing guides and grid layouts as a PNG and then automatically convert that into an NEF for use in the camera. The documentation on my GitHub has all the details on how to use and apply these overlays. Here is a quick video showing an overlay in use:





Nov 14, 2025 at 12:46 PM
EB-1
Offline
• • • • • • •
Upload & Sell: Off
p.1 #2 · img2nef - convert any image into a NIkon NEF raw


Is there any chance that would work for Sony and Canon also?

EBH



Nov 14, 2025 at 04:50 PM
snapsy
Offline
• • • • • •
Upload & Sell: On
p.1 #3 · img2nef - convert any image into a NIkon NEF raw


EB-1 wrote:
Is there any chance that would work for Sony and Canon also?

EBH


I would have to write a different raw encoder for each of those systems, which I don't currently have plans to do. If I did, the supporting logic around the encoder could be reused though.



Nov 14, 2025 at 06:22 PM
Fred Miranda
Offline
Admin
Upload & Sell: On
p.1 #4 · img2nef - convert any image into a NIkon NEF raw


This is super creative as always, Adam. The overlay feature is really useful, so useful in fact that Sony even charges extra for it as a separate add-on.

Out of curiosity, is there any other benefit to converting images to NEF RAW, or is it mainly for the overlay workflow?



May 30, 2026 at 05:18 PM
snapsy
Offline
• • • • • •
Upload & Sell: On
p.1 #5 · img2nef - convert any image into a NIkon NEF raw


Fred Miranda wrote:
This is super creative as always, Adam. The overlay feature is really useful, so useful in fact that Sony even charges extra for it as a separate add-on.

Out of curiosity, is there any other benefit to converting images to NEF RAW, or is it mainly for the overlay workflow?


Thanks Fred. The main impetus for the NEF encoder was part of my c2pa exploit work (Short summary an AI researcher posted, Petapixel article, My technical deep-dive) and the overlay feature. I've also used it to reverse-engineer how ACR handles certain raw details.



May 31, 2026 at 02:51 AM







FM Forums | Nikon Forum | Join Upload & Sell

    
 

Welcome back
Log in to your account