ladybird/Userland/Utilities
Nico Weber 926c0d8676 ICC+image: Add conversion between color spaces for images :^)
For now, only for color spaces that are supported by Profile::to_pcs()
and Profile::from_pcs(), which currently means that all matrix profiles
(but not LUT profiles) in the source color space work, and that
matrix profiles with parametric curves in the destination color
space work.

This adds Profile::convert_image(Bitmap, source_profile), and
adds a `--convert-to-color-profile file.icc` flag to `image`.

It only takes a file path, so to use it with the built-in
sRGB profile, you have to write it to a file first:

% Build/lagom/icc -n sRGB --reencode-to serenity-sRGB.icc

`image` by default writes the source image's color profile
to the output image, and most image viewers display images
looking at the profile.

For example, take `Seven_Coloured_Pencils_(rg-switch_sRGB).jpg`
from https://commons.wikimedia.org/wiki/User:Colin/BrowserTest.

It looks normal in image viewers because they apply the unusual
profile embedded in the profile. But if you run

% Build/lagom/image -o huh.png --strip-color-profile \
    'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'

and then look at huh.png, you can see how the image's colors
look like when interpreted as sRGB (which is the color space
PNG data is in if the PNG doesn't store an embedded profile).

If you now run

% Build/lagom/image -o wow.png \
    --convert-to-color-profile serenity-sRGB.icc --strip-color-profile \
    'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'

this will convert that image to sRGB, but then not write
the profile to the output image (verify with `Build/lagom/icc wow.png`).
It will look correct in image viewers, since they display PNGs without
an embedded color profile as sRGB.

(This works because 'Seven_Coloured_Pencils_(rg-switch_sRGB).jpeg'
contains a matrix profile, and Serenity's built-in sRGB profile
uses a matrix profile with a parametric curve.)
2023-05-03 15:05:13 +02:00
..
abench.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
adjtime.cpp Utilities: Use lround() instead of casting round() to long 2023-04-22 07:17:08 +02:00
allocate.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
aplay.cpp Aplay: Determine absolute path before first unveil 2023-04-24 14:50:11 +02:00
arp.cpp arp: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
asctl.cpp asctl: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
base64.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
basename.cpp Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
beep.cpp Kernel+Userland: Add support for using the PCSpeaker with various tones 2023-03-05 08:38:29 +00:00
blockdev.cpp blockdev: Use Core::System::open() instead of LibC open() 2023-01-08 15:19:59 +00:00
bt.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
cal.cpp AK+Everywhere: Disallow Error::from_string_view(FooString) 2023-04-28 05:55:20 +02:00
cat.cpp AK: Rename Stream::{read,write} to Stream::{read_some,write_some} 2023-03-13 15:16:20 +00:00
checksum.cpp AK: Rename Stream::{read,write} to Stream::{read_some,write_some} 2023-03-13 15:16:20 +00:00
chgrp.cpp chgrp: Use StringView instead of 'char const*' 2023-01-08 19:02:50 +01:00
chmod.cpp chmod: Implement the --recursive flag 2022-07-25 15:32:46 +02:00
chown.cpp chown: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
chres.cpp Userland: Always construct Application with try_create() 2022-04-18 12:57:34 +02:00
cksum.cpp cksum: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
clear.cpp Utilities: Use default execpromises parameter to pledge(..) 2022-04-03 17:13:51 -07:00
CMakeLists.txt Utilities: Add more commands, addresses, spaces, cmdline parsing to sed 2023-04-09 18:09:23 -06:00
cmp.cpp cmp: Replace uses of DeprecatedString 2023-04-22 07:17:08 +02:00
comm.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
config.cpp config: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
copy.cpp copy: Stop using DeprecatedString 2023-04-22 07:17:08 +02:00
cp.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
cpp-lexer.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
cpp-parser.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
cpp-preprocessor.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
cut.cpp Userland+AK: Stop using getopt() for ArgsParser 2023-02-28 15:52:24 +03:30
date.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
dd.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
df.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
diff.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
dirname.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
disasm.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
disk_benchmark.cpp disk_benchmark: Remove the call to umask 2023-03-31 09:43:00 +02:00
dmesg.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
du.cpp LibCore+Everywhere: Return an Error from DirIterator::error() 2023-03-05 20:23:42 +01:00
echo.cpp AK: Remove StringBuilder::build() in favor of to_deprecated_string() 2023-01-27 20:38:49 +00:00
env.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
errno.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
expr.cpp AK: Remove StringBuilder::build() in favor of to_deprecated_string() 2023-01-27 20:38:49 +00:00
false.cpp false: Port to LibMain 2022-01-14 19:42:19 +02:00
fdtdump.cpp LibDeviceTree: Add a slow, allocation-free property fetch API 2023-02-19 13:49:07 +01:00
file.cpp LibCore+file: Factorize code to detect mime-type from bytes of a file 2023-04-27 07:29:49 +02:00
find.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
flock.cpp Everywhere: Remove unused includes of LibC/stdlib.h 2023-01-02 20:27:20 -05:00
fortune.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
functrace.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
gml-format.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
grep.cpp grep: Read patterns from a file with -f 2023-04-01 13:49:47 -06:00
gron.cpp Userland+AK: Stop using getopt() for ArgsParser 2023-02-28 15:52:24 +03:30
groupadd.cpp Everywhere: Use my fairly new and shiny serenityos.org email :^) 2022-06-30 15:59:42 +01:00
groupdel.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
groups.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
gunzip.cpp gunzip+LibCompress: Move utility to decompress files to GzipDecompressor 2023-04-01 08:15:49 +02:00
gzip.cpp gzip: Use utilities from LibCompress to (de)compress files 2023-04-01 08:15:49 +02:00
head.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
headless-browser.cpp Ladybird: Define AK_DONT_REPLACE_STD via CMake rather than in every file 2023-04-24 14:49:04 +02:00
hello-world.jakt Meta+Userland: Add jakt as an optional Lagom Tool 2022-05-23 23:05:45 +02:00
hexdump.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
host.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
hostname.cpp Userland: Convert command line arguments to String/StringView 2022-07-12 23:11:35 +02:00
icc.cpp icc: Add a --measure flag that prints color difference in profile 2023-04-30 05:57:20 +02:00
id.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
ifconfig.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
image.cpp ICC+image: Add conversion between color spaces for images :^) 2023-05-03 15:05:13 +02:00
image2bin.cpp LibGfx: Remove try_ prefix from bitmap creation functions 2023-01-26 20:24:37 +00:00
ini.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
install.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
jail-attach.cpp Kernel: Allow configuring a Jail to not impose PID isolation restriction 2023-04-24 12:15:29 +02:00
jail-create.cpp Kernel: Allow configuring a Jail to not impose PID isolation restriction 2023-04-24 12:15:29 +02:00
js.cpp LibJS: Port Value::to_object() to NonnullGCPtr 2023-04-14 09:59:29 +02:00
json.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
kcov-example.cpp Kernel+Userland: Unify declarations for KCOV in Kernel/API/kcov.h 2023-02-24 20:35:45 +01:00
keymap.cpp Everywhere: Remove needless copies of Error / ErrorOr instances 2023-02-10 09:08:52 +00:00
kill.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
killall.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
ldd.cpp ldd: Pledge map_fixed 2023-04-17 19:29:20 -04:00
less.cpp less: Stop adding extra blank lines 2023-03-06 21:44:28 +01:00
ln.cpp Everywhere: Remove needless copies of Error / ErrorOr instances 2023-02-10 09:08:52 +00:00
logout.cpp Userland: Remove a bunch of unveil calls on /sys/kernel/processes 2023-01-13 13:41:30 +01:00
ls.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
lsblk.cpp LibCore+Everywhere: Return an Error from DirIterator::error() 2023-03-05 20:23:42 +01:00
lscpu.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
lsirq.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
lsjails.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
lsof.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
lspci.cpp LibCore+Everywhere: Return an Error from DirIterator::error() 2023-03-05 20:23:42 +01:00
lsusb.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
lzcat.cpp lzcat: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
man.cpp man: Skip shellrc when invoking pager using sh 2023-03-07 00:42:32 +01:00
markdown-check.cpp AK+Everywhere: Change URL::path() to serialize_path() 2023-04-15 06:37:04 +02:00
matroska.cpp AK+Everywhere: Do not implicitly copy variables in TRY macros 2023-02-10 09:08:52 +00:00
md.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
mkdir.cpp AK: Remove StringBuilder::build() in favor of to_deprecated_string() 2023-01-27 20:38:49 +00:00
mkfifo.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
mknod.cpp mknod: Port to LibMain 2022-01-24 14:01:58 +03:30
mktemp.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
mount.cpp LibCore+Everywhere: Return an Error from DirIterator::error() 2023-03-05 20:23:42 +01:00
mv.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
nc.cpp nc: Fix overflow in port and local_port argument 2023-04-30 21:12:46 +03:30
netstat.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
nl.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
nologin.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
notify.cpp LibGfx: Remove try_ prefix from bitmap creation functions 2023-01-26 20:24:37 +00:00
nproc.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
ntpquery.cpp Utilities: Use lround() instead of casting round() to long 2023-04-22 07:17:08 +02:00
open.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
passwd.cpp passwd: Use StringView instead of DeprecatedString 2023-01-08 17:10:53 +01:00
paste.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
pathchk.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
pgrep.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
pidof.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
ping.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
pkill.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
pledge.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
pls.cpp Userland/pls: Use Core::System::exec_command method to execute a command 2022-11-05 18:00:58 -06:00
pmap.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
pmemdump.cpp Everywhere: Remove unused includes of LibC/stdlib.h 2023-01-02 20:27:20 -05:00
printf.cpp AK: Remove StringBuilder::build() in favor of to_deprecated_string() 2023-01-27 20:38:49 +00:00
pro.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
profile.cpp profile: Prevent crash when -p is supplied a non-integer value 2023-05-03 09:57:43 +02:00
ps.cpp LibCore: Use Core::Stream for ProcessStatisticsReader 2022-12-10 11:49:24 +00:00
purge.cpp purge: Port to LibMain 2022-03-22 11:39:20 +01:00
pwd.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
readelf.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
readlink.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
realpath.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
reboot.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
rev.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
rm.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
rmdir.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
route.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
run-tests.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
sed.cpp Everywhere: Fix a few typos 2023-04-12 19:37:35 +02:00
seq.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
shot.cpp LibGfx: Move all image loaders and writers to a subdirectory 2023-03-21 22:39:25 +01:00
shuf.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
shutdown.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
sleep.cpp Utilities: Use default execpromises parameter to pledge(..) 2022-04-03 17:13:51 -07:00
sort.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
sql.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
stat.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
strace.cpp Kernel/Net: Implement SIOCGIFINDEX and SIOCGIFNAME for sockets 2023-04-14 12:29:03 +01:00
strings.cpp AK: Rename Stream::{read,write} to Stream::{read_some,write_some} 2023-03-13 15:16:20 +00:00
stty.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
su.cpp su: Only check for an interactive tty if a password is actually needed 2023-02-16 12:52:11 +00:00
sync.cpp sync: Port to LibMain 2022-02-01 04:58:24 +00:00
syscall.cpp LibCore+Userland: Remove ArgsParser::add*(Vector<char const*>&) 2023-03-01 10:47:19 +01:00
sysctl.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
tac.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
tail.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
tar.cpp tar: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
tee.cpp Everywhere: Use my fairly new and shiny serenityos.org email :^) 2022-06-30 15:59:42 +01:00
telws.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
test-bindtodevice.cpp test-bindtodevice: Port to LibMain 2022-03-29 21:28:29 -07:00
test-fuzz.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
test-imap.cpp LibCore+Userland: Allow canceling promises 2023-03-13 12:12:17 +00:00
test-pthread.cpp Everywhere: Remove NonnullRefPtr.h includes 2023-03-06 23:46:35 +01:00
test-unveil.cpp Userland+AK: Stop using getopt() for ArgsParser 2023-02-28 15:52:24 +03:30
test.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
test_env.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
timezone.cpp Everywhere: Update copyrights with my new serenityos.org e-mail :^) 2022-01-31 18:23:22 +00:00
top.cpp Kernel+Userland: Remove the nfds entry from /sys/kernel/processes 2023-04-21 13:55:23 +02:00
touch.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
tr.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
traceroute.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
tree.cpp LibCore+Everywhere: Return an Error from DirIterator::error() 2023-03-05 20:23:42 +01:00
true.cpp true: Port to LibMain 2022-03-22 11:39:20 +01:00
truncate.cpp Userland+AK: Stop using getopt() for ArgsParser 2023-02-28 15:52:24 +03:30
tsort.cpp AK: Add take_first to HashTable and rename pop to take_last 2023-02-21 22:13:06 +01:00
tt.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
ttfdisasm.cpp Userland+AK: Stop using getopt() for ArgsParser 2023-02-28 15:52:24 +03:30
tty.cpp tty: Port to LibMain 2022-03-29 21:28:29 -07:00
umount.cpp umount: Port to LibMain 2022-01-22 13:31:52 +02:00
uname.cpp Everywhere: Rename to_{string => deprecated_string}() where applicable 2022-12-06 08:54:33 +01:00
uniq.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
unveil.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
unzip.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
update-cpp-test-results.cpp AK+Everywhere: Rename String to DeprecatedString 2022-12-06 08:54:33 +01:00
uptime.cpp AK: Rename Stream::{read,write} to Stream::{read_some,write_some} 2023-03-13 15:16:20 +00:00
useradd.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
userdel.cpp Everywhere: Remove unused DeprecatedString includes 2023-04-09 22:00:54 +02:00
usermod.cpp LibCore: Rename File to DeprecatedFile 2023-02-13 00:50:07 +00:00
utmpupdate.cpp Everywhere: Remove unintentional partial stream reads and writes 2023-03-13 15:16:20 +00:00
w.cpp LibCore: Remove Stream.h 2023-02-13 00:50:07 +00:00
wallpaper.cpp LibGfx: Remove try_ prefix from bitmap creation functions 2023-01-26 20:24:37 +00:00
wasm.cpp Utilities: Add support for loading the WASI module to wasm 2023-04-26 03:47:15 +03:30
watch.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
wc.cpp Utilities: Replace ctype.h usage with AK/CharacterTypes.h 2023-04-22 07:17:08 +02:00
which.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
whoami.cpp whoami: Port to LibMain :^) 2021-11-30 23:34:40 +01:00
wsctl.cpp Userland: Always construct Application with try_create() 2022-04-18 12:57:34 +02:00
xargs.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
xml.cpp AK+Everywhere: Change URL::path() to serialize_path() 2023-04-15 06:37:04 +02:00
xzcat.cpp xzcat: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
yes.cpp LibCore+Everywhere: Remove ArgsParser::add*(char const*&) 2023-03-01 10:47:19 +01:00
zip.cpp Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00