Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Krzyszkowiak
megapixels
Commits
ab5c75d4
Commit
ab5c75d4
authored
Jul 05, 2021
by
Sebastian Krzyszkowiak
Browse files
Merge branch 'thumb' into 'master'
Store a proper thumbnail in the DNG file See merge request Librem5/megapixels!42
parents
3491cf2f
df7400f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
process_pipeline.c
View file @
ab5c75d4
...
@@ -225,9 +225,9 @@ process_image_for_capture(const MPImage *image, int count)
...
@@ -225,9 +225,9 @@ process_image_for_capture(const MPImage *image, int count)
}
}
// Define TIFF thumbnail
// Define TIFF thumbnail
int
thumbnail_width
=
image
->
width
>>
4
;
int
thumbnail_height
=
image
->
height
>>
4
;
TIFFSetField
(
tif
,
TIFFTAG_SUBFILETYPE
,
1
);
TIFFSetField
(
tif
,
TIFFTAG_SUBFILETYPE
,
1
);
TIFFSetField
(
tif
,
TIFFTAG_IMAGEWIDTH
,
image
->
width
>>
4
);
TIFFSetField
(
tif
,
TIFFTAG_IMAGELENGTH
,
image
->
height
>>
4
);
TIFFSetField
(
tif
,
TIFFTAG_BITSPERSAMPLE
,
8
);
TIFFSetField
(
tif
,
TIFFTAG_BITSPERSAMPLE
,
8
);
TIFFSetField
(
tif
,
TIFFTAG_COMPRESSION
,
COMPRESSION_NONE
);
TIFFSetField
(
tif
,
TIFFTAG_COMPRESSION
,
COMPRESSION_NONE
);
TIFFSetField
(
tif
,
TIFFTAG_PHOTOMETRIC
,
PHOTOMETRIC_RGB
);
TIFFSetField
(
tif
,
TIFFTAG_PHOTOMETRIC
,
PHOTOMETRIC_RGB
);
...
@@ -249,7 +249,9 @@ process_image_for_capture(const MPImage *image, int count)
...
@@ -249,7 +249,9 @@ process_image_for_capture(const MPImage *image, int count)
}
}
TIFFSetField
(
tif
,
TIFFTAG_ORIENTATION
,
orientation
);
TIFFSetField
(
tif
,
TIFFTAG_ORIENTATION
,
orientation
);
TIFFSetField
(
tif
,
TIFFTAG_DATETIME
,
datetime
);
TIFFSetField
(
tif
,
TIFFTAG_DATETIME
,
datetime
);
TIFFSetField
(
tif
,
TIFFTAG_SAMPLESPERPIXEL
,
3
);
TIFFSetField
(
tif
,
TIFFTAG_SAMPLESPERPIXEL
,
4
);
int
extrasamples
=
EXTRASAMPLE_UNSPECIFIED
;
TIFFSetField
(
tif
,
TIFFTAG_EXTRASAMPLES
,
1
,
&
extrasamples
);
TIFFSetField
(
tif
,
TIFFTAG_PLANARCONFIG
,
PLANARCONFIG_CONTIG
);
TIFFSetField
(
tif
,
TIFFTAG_PLANARCONFIG
,
PLANARCONFIG_CONTIG
);
TIFFSetField
(
tif
,
TIFFTAG_SOFTWARE
,
"Megapixels"
);
TIFFSetField
(
tif
,
TIFFTAG_SOFTWARE
,
"Megapixels"
);
long
sub_offset
=
0
;
long
sub_offset
=
0
;
...
@@ -276,14 +278,26 @@ process_image_for_capture(const MPImage *image, int count)
...
@@ -276,14 +278,26 @@ process_image_for_capture(const MPImage *image, int count)
TIFFSetField
(
tif
,
TIFFTAG_ASSHOTNEUTRAL
,
3
,
WB_WHITEPOINTS
[
wb
]);
TIFFSetField
(
tif
,
TIFFTAG_ASSHOTNEUTRAL
,
3
,
WB_WHITEPOINTS
[
wb
]);
}
}
TIFFSetField
(
tif
,
TIFFTAG_CALIBRATIONILLUMINANT1
,
21
);
// D65
TIFFSetField
(
tif
,
TIFFTAG_CALIBRATIONILLUMINANT1
,
21
);
// D65
// Write black thumbnail, only windows uses this
{
{
unsigned
char
*
buf
=
uint32_t
surface_width
,
surface_height
,
skip
;
(
unsigned
char
*
)
calloc
(
1
,
(
image
->
width
>>
4
)
*
3
);
quick_preview_size
(
&
surface_width
,
&
surface_height
,
&
skip
,
thumbnail_width
,
for
(
int
row
=
0
;
row
<
(
image
->
height
>>
4
);
row
++
)
{
thumbnail_height
,
image
->
width
,
image
->
height
,
TIFFWriteScanline
(
tif
,
buf
,
row
,
0
);
image
->
pixel_format
,
0
);
TIFFSetField
(
tif
,
TIFFTAG_IMAGEWIDTH
,
surface_width
);
TIFFSetField
(
tif
,
TIFFTAG_IMAGELENGTH
,
surface_height
);
uint8_t
*
pixels
=
malloc
(
surface_width
*
4
*
surface_height
);
quick_preview
((
uint32_t
*
)
pixels
,
surface_width
,
surface_height
,
image
->
data
,
image
->
width
,
image
->
height
,
image
->
pixel_format
,
0
,
false
,
camera
->
previewmatrix
[
0
]
==
0
?
NULL
:
camera
->
previewmatrix
,
camera
->
blacklevel
,
skip
);
for
(
int
row
=
0
;
row
<
thumbnail_height
;
row
++
)
{
TIFFWriteScanline
(
tif
,
pixels
+
surface_width
*
4
*
row
,
row
,
0
);
}
}
free
(
buf
);
free
(
pixels
);
}
}
TIFFWriteDirectory
(
tif
);
TIFFWriteDirectory
(
tif
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment