Giter Club home page Giter Club logo

Comments (5)

n0vad3v avatar n0vad3v commented on July 20, 2024

From our docs:

Currently supported image format: JPEG, PNG, BMP, GIF, SVG, HEIC

NEF format is currently NOT supported, and the problem seems libwebp related, I've tried using cwebp like:

cwebp DSC_0001.NEF -o output.webp
TIFFReadDirectory: Warning, Unknown field with tag 36867 (0x9003) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37398 (0x9216) encountered.
Saving file 'output.webp'
File:      DSC_0001.NEF
Dimension: 160 x 120
Output:    4310 bytes Y-U-V-All-PSNR 37.27 38.71 39.62   37.81 dB
           (1.80 bpp)
block count:  intra4:         64  (80.00%)
              intra16:        16  (20.00%)
              skipped:         6  (7.50%)
bytes used:  header:            142  (3.3%)
             mode-partition:    335  (7.8%)
 Residuals bytes  |segment 1|segment 2|segment 3|segment 4|  total
    macroblocks:  |      20%|      21%|      38%|      21%|      80
      quantizer:  |      36 |      30 |      22 |      16 |
   filter level:  |      11 |       7 |       4 |       2 |
du -ch DSC_0001.NEF
12M	DSC_0001.NEF
12M	total

du -ch output.webp 
8.0K	output.webp
8.0K	total

This gives similar results from what you've posted.

from webp_server_go.

llanc avatar llanc commented on July 20, 2024

How about converting NEF (RAW) images to JPG first and then to WEBP?

from webp_server_go.

n0vad3v avatar n0vad3v commented on July 20, 2024

How about converting NEF (RAW) images to JPG first and then to WEBP?

No, it's not that easy, NEF images are little bit hard to deal with, for example, if you use file to check for a NEF image, you'll find it has no standard dimension data:

file 1.NEF 
1.NEF: TIFF image data, big-endian, direntries=25, height=0, bps=0, compression=none, PhotometricInterpretation=RGB, manufacturer=NIKON CORPORATION, model=NIKON XXXXX, orientation=upper-left, width=0

Note height=0 and width=0

So currently we suggest you to convert those NEF images to JPEG or some other supported image formats before using WebP Server Go to render them.

BTW, I've tried https://github.com/rwcarlsen/goexif for extracting info from the above NEF image, and has incorrect results:

package main

import (
	"fmt"
	"os"

	"github.com/rwcarlsen/goexif/exif"
	"github.com/rwcarlsen/goexif/mknote"
)

func main() {

	nefFile, err := os.Open("1.NEF")
	if err != nil {
		fmt.Println(err)
	}
	defer nefFile.Close()
	exif.RegisterParsers(mknote.All...)

	exifData, err := exif.Decode(nefFile)
	if err != nil {
		fmt.Println(err)
	}

	camModel, _ := exifData.Get(exif.Model) // normally, don't ignore errors!
	fmt.Println(camModel.StringVal())

	XResolution, _ := exifData.Get(exif.XResolution)
	YResolution, _ := exifData.Get(exif.YResolution)
	ResolutionUnit, _ := exifData.Get(exif.ResolutionUnit)
	PixelXDimension, _ := exifData.Get(exif.PixelXDimension)
	PixelYDmension, _ := exifData.Get(exif.PixelYDimension)
	ImageWidth, _ := exifData.Get(exif.ImageWidth)
	ImageLength, _ := exifData.Get(exif.ImageLength)

	fmt.Println(XResolution)
	fmt.Println(YResolution)
	fmt.Println(ResolutionUnit)
	fmt.Println(PixelXDimension)
	fmt.Println(PixelYDmension)
	fmt.Println(ImageWidth)
	fmt.Println(ImageLength)
}

The output from above program is:

NIKON XXXXX <nil>
"300/1"
"300/1"
2
<nil>
<nil>
160
120

While it's correct dimension is 4608 x 3072.

Screenshot from 2023-10-14 19-50-57

from webp_server_go.

llanc avatar llanc commented on July 20, 2024

I saw a library from https://github.com/gavinwade12/nef2jpeg that can convert NEF to JPG normally: https://github.com/jeremytorres/rawparser

My test results:
NEF
image

JPG
image
image

from webp_server_go.

llanc avatar llanc commented on July 20, 2024

#284

from webp_server_go.

Related Issues (20)

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.