Giter VIP home page Giter VIP logo

cng2jpg's Introduction

cng2jpg

Convert "Complete National Geographic" CNG files to JPG for use under Linux

Basic usage

copying from CD into local hard drive:

cng2jpg.py --src /run/media/_user_/CNG_DISC1/disc1/images --dst ~/CNG/discs/images

convert a hard drive copy

cng2jpg.py --src ~/CNG/discs [--remove]

Use --remove to get rid of .cng files as they are converted, to avoid needing extra 40+Gb of space for both jpg and cng.

References

"The cng files are all jpegs, XOR'd bitwise with 239"

http://www.subdude-site.com/WebPages_Local/RefInfo/Computer/Linux/LinuxGuidesByBlaze/appsImagePhotoTools/cng2jpgGuide/cng2jpg_guide.htm

cng2jpg's People

Contributors

jeremy-preseem avatar laurb9 avatar miica37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cng2jpg's Issues

Running under Windows

Hi, much thanks for the providing the script!

While running the script under Windows, i found that the generated jpgs open with errors. When opening the jpg with Photoshop, it pops up a dialog about the file may be truncated or incomplete, which is the case. The jpg file size is too small (most around 6 to 7KB). In the end, I found that in the code, open the file using binary mode fix the problem.

I changed open(src_filename, 'r') to open(src_filename, 'rb') and open(dst_filename, 'w') to open(dst_filename, 'wb').

Another thing I noticed while running the script second time (because the first time I used the remove option and part of the files are replaced with bad jpgs, I replace those jpgs back with their correspond cngs), the script won't convert the cng. It appears that the code didn't detect the file extension because they are uppercase (eg. "NGM_1995_08_001_4.CNG").

I changed if ext == '.cng' to if ext**.lower()** == '.cng'.

(However I also wonder why the first time it works.)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.