mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
move colors/icc into thumbs/icc + asets
This commit is contained in:
parent
b5ed90d0cf
commit
ac3d5a0c58
5 changed files with 75 additions and 52 deletions
54
assets/profiles/icc/NOTICE
Normal file
54
assets/profiles/icc/NOTICE
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
Files: compatibleWithAdobeRGB1998.icc
|
||||
Source: Debian icc-profiles-free
|
||||
https://salsa.debian.org/debian/icc-profiles-free/-/tree/a7a3c11b8a6d3bc2937447183b87dc89de9d2388/icc-profiles-openicc/default_profiles/base
|
||||
Copyright: Kai-Uwe Behrmann <www.behrmann.name>
|
||||
Marti Maria <www.littlecms.com>
|
||||
Photogamut <www.photogamut.org>
|
||||
Graeme Gill <www.argyllcms.com>
|
||||
ColorSolutions <www.basICColor.com>
|
||||
License: Zlib
|
||||
|
||||
License: Zlib
|
||||
The zlib/libpng License
|
||||
.
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
.
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
.
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
.
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
.
|
||||
NO WARRANTY
|
||||
.
|
||||
BECAUSE THE DATA IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE DATA, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE DATA "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE DATA IS WITH YOU. SHOULD THE
|
||||
DATA PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
.
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE DATA AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE DATA (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE DATA TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
21
internal/thumb/icc.go
Normal file
21
internal/thumb/icc.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package thumb
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
/*
|
||||
Possible TODO: move this into a shared pkg/ so non-thumb
|
||||
consumers can also use it. However, it looks fiddly to hook that
|
||||
up to `assets`, so I'm punting on that for now.
|
||||
*/
|
||||
|
||||
func MustGetAdobeRGB1998Path() string {
|
||||
p := path.Join(IccProfilesPath, "compatibleWithAdobeRGB1998.icc")
|
||||
_, err := os.Stat(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return p
|
||||
}
|
||||
|
|
@ -9,7 +9,6 @@ import (
|
|||
|
||||
"github.com/photoprism/photoprism/pkg/clean"
|
||||
"github.com/photoprism/photoprism/pkg/fs"
|
||||
"github.com/photoprism/photoprism/pkg/media/colors"
|
||||
)
|
||||
|
||||
// Vips generates a new thumbnail with the requested size and returns the file name and a buffer with the image bytes,
|
||||
|
|
|
|||
|
|
@ -1,51 +0,0 @@
|
|||
package colors
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// this was pulled from the Debian package
|
||||
// icc-profiles-free, where it is published with
|
||||
// an MIT-style licence:
|
||||
// https://salsa.debian.org/debian/icc-profiles-free/-/blob/master/icc-profiles-openicc/default_profiles/base/compatibleWithAdobeRGB1998.icc?ref_type=heads
|
||||
//
|
||||
//go:embed icc/compatibleWithAdobeRGB1998.icc
|
||||
var compatibleWithAdobeRGB1998 []byte
|
||||
|
||||
var compatibleWithAdobeRGB1998Path = ""
|
||||
|
||||
var temporaryDirectory string = ""
|
||||
|
||||
func getTemporaryDirectory() (string, error) {
|
||||
if temporaryDirectory != "" {
|
||||
return temporaryDirectory, nil
|
||||
}
|
||||
var err error
|
||||
temporaryDirectory, err = os.MkdirTemp("", "photoprism-icc-")
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%w creating temp dir for ICC profiles", err)
|
||||
}
|
||||
return temporaryDirectory, nil
|
||||
}
|
||||
|
||||
func GetAdobeRGB1998Path() (p string, err error) {
|
||||
if compatibleWithAdobeRGB1998Path != "" {
|
||||
return compatibleWithAdobeRGB1998Path, nil
|
||||
}
|
||||
|
||||
tempDir, err := getTemporaryDirectory()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
p = path.Join(tempDir, "compatibleWithAdobeRGB1998.icc")
|
||||
|
||||
err = os.WriteFile(p, compatibleWithAdobeRGB1998, 0644)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("%w writing icc profile to temp dir", err)
|
||||
}
|
||||
compatibleWithAdobeRGB1998Path = p
|
||||
return p, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue