GithubHelp home page GithubHelp logo

bradenm / pydngconverter Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 5.0 3.3 MB

Python Interface for the Adobe DNG Converter

Home Page: https://bradenm.github.io/pydngconverter/

License: MIT License

Makefile 6.58% Python 93.42%
python adobe-dng-converter dng raw-image interface

pydngconverter's Introduction

PyDNGConverter

Python Interface for the Adobe's DNG Converter.

Utilizing parallel processing, PyDNGConverter can convert RAW images to DNG up to ~60% faster than simply utilizing Adobe's DNG Converter.

Installation

sudo apt-get install gcc python3-dev
pip install -U pydngconverter

To utilize PyDNGConverter's Exif thumbnail extraction (as opposed to Adobe DNG Converters'), the following dependencies are required:

Then specify JPEGPreview.EXTRACT for DNGConverters jpeg_preview parameter.

Alternatively, you can utilize Adobe DNG Converters' thumbnail extraction via:

  • JPEGPreview.MEDIUM
  • JPEGPreview.FULL

Or, disable thumbnails via:

  • JPEGPreview.NONE

Example

import asyncio
from pydngconverter import DNGConverter, flags

async def main():
    # Create converter instance.
    pydng = DNGConverter('/my/raw/files/',
                        dest='/dngfiles',
                        jpeg_preview=flags.JPEGPreview.EXTRACT,
                        fast_load=True,
                        )
    # Convert all
    return await pydng.convert()

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

pydngconverter's People

Contributors

adammainstl avatar agentschmisch avatar bradenm avatar github-actions[bot] avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pydngconverter's Issues

Issue with wand import not being found

  • pydngconverter version: latest
  • Python version: 3.10
  • Operating System: Mac OS Silicon

Description

I am trying to run the example code on my machine to convert a raw file to a DNG and I'm getting an error about the wand import not being found

What I Did

Code

import asyncio
import sys
from pydngconverter import DNGConverter, flags


async def main():
    # Create converter instance.
    pydng = DNGConverter(
        sys.argv[1],
        dest="/dngfiles",
        jpeg_preview=flags.JPEGPreview.EXTRACT,
        fast_load=True,
    )
    # Convert all
    return await pydng.convert()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

Command

python dngconvert.py public/test.ARW

Traceback

/Users/flynn/Documents/labs/pixellabs/pixel/dngconvert.py:18: DeprecationWarning: There is no current event loop
  loop = asyncio.get_event_loop()
[10:41:18] INFO     pydngconverter.utils: resolved executable for: Adobe DNG Converter @ /Applications/Adobe compat.py:151
                    DNG Converter.app/Contents/MacOS/Adobe DNG Converter                                                  
           INFO     pydngconverter.utils: resolved executable for: exiftool @ /opt/homebrew/bin/exiftool     compat.py:151
Traceback (most recent call last):
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/api.py", line 154, in <module>
    libraries = load_library()
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/api.py", line 143, in load_library
    raise IOError('cannot find library; tried paths: ' + repr(tried_paths))
OSError: cannot find library; tried paths: []

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/pydngconverter/main.py", line 17, in <module>
    from wand.image import Image
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/image.py", line 18, in <module>
    from . import assertions
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/assertions.py", line 155, in <module>
    from .color import Color  # noqa: E402
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/color.py", line 10, in <module>
    from .api import library
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/wand/api.py", line 178, in <module>
    raise ImportError('MagickWand shared library not found.\n'
ImportError: MagickWand shared library not found.
You probably had not installed ImageMagick library.
Try to install:
  brew install freetype imagemagick

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/flynn/Documents/labs/pixellabs/pixel/dngconvert.py", line 19, in <module>
    loop.run_until_complete(main())
  File "/Users/flynn/anaconda3/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/Users/flynn/Documents/labs/pixellabs/pixel/dngconvert.py", line 8, in main
    pydng = DNGConverter(
  File "/Users/flynn/anaconda3/lib/python3.10/site-packages/pydngconverter/main.py", line 90, in __init__
    raise RuntimeError(
RuntimeError: Cannot use JPEG Preview EXTRACT because wand failed to import!
Warning: imagemagick 7.1.1-9 is already installed and up-to-date.
To reinstall 7.1.1-9, run:
  brew reinstall imagemagick

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Other Branches

These updates are pending. To force PRs open, click the checkbox below.

  • chore(deps): update dependency pre-commit to v3.7.1
  • chore(deps): update dependency sphinx-autodoc-typehints to v1.25.3

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

asdf
.tool-versions
  • python 3.12.3
  • poetry 1.8.3
github-actions
.github/workflows/changelog.yml
  • actions/checkout v3
  • actions/setup-go v3
  • ad-m/github-push-action 9870d48124da805820c70ebc6ba563c715551019
.github/workflows/main.yml
  • actions/checkout v3
  • actions/setup-python v4
  • codecov/codecov-action v3
.github/workflows/publish.yml
  • actions/checkout v3
  • actions/setup-python v4
.github/workflows/release.yml
  • google-github-actions/release-please-action v3
pep621
pyproject.toml
poetry
pyproject.toml
  • python ^3.8
  • psutil ~5.9
  • Wand ~0.6
  • rich ^13.3.1
  • typing-extensions ^4.5.0
  • coveralls ^3.0.0
  • isort ^5.7.0
  • black ^23.1.0
  • pytest ^7.0.0
  • pytest-coverage ^0.0
  • pytest-mock ^3.5.1
  • pytest-asyncio ^0.23.0
  • mypy ^1.0.1
  • pytest-sugar ^0.9.4
  • pytest-cov ^4.0.0
  • pre-commit ^3.1.1
  • ruff ^0.4.0
  • sphinx ^6.0.0
  • sphinx-autodoc-typehints ^1.11.1
  • recommonmark ^0.7.1
  • sphinx_rtd_theme ^1.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Image Format

Does this only work for JPEG images? What if I have .PNG images

Requirement Error while installing

  • pydngconverter version: latest
  • Python version: 3.10
  • Operating System: Ubuntu 22.04

Description

I was trying to install pydngconverter with pip install pydngconverter when i encountered the error of missing the gcc compiler

What I Did

Ran the following commands to install successfully

sudo apt-get install gcc python3-dev

I will have a look into the dependencies and make a pull request afterwards

Size and count parameters don't work

  • pydngconverter version: 0.20
  • Python version: 3.8.5
  • Operating System: Windows 10

Description

I've been trying to generate resized dng using side and count parameters. But there's a bug which prevents args passed to the .exe treated properly.

What I Did

I took the example and added side=600 to it

#!/usr/local/bin/python
# -*- coding: utf-8 -*-

import asyncio
from pydngconverter import DNGConverter, flags

path = 'nef\\'
dest = 'dng\\'

async def main():
    pydng = DNGConverter(path,                        
                        dest=dest,
                        jpeg_preview=flags.JPEGPreview.NONE,
                        fast_load=False,
                        side=600,
                        lossy=flags.LossyCompression.YES,
                        debug=True
                        )

    # Convert all
    return await pydng.convert()

loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

Expected result

Get files with 600px longest side.

Actual result

Got files with original size.

Fix:

You need to separate arguments from each other, something like this:

        if self.side:
            yield f"-side"
            yield f"{self.side}"
        if self.count:
            yield f"-count"
            yield f"{self.count}"

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.