Skip to content

Commit

Permalink
Adjustments > Color > Color lookup: a full set of filters is now avai…
Browse files Browse the repository at this point in the history
…lable!

A set of 32 LUTs now ship with PD by default.  These 32 filters are adopted from popular Instagram filters.  I've minimized them as best I can so they only require ~100 KB in the .exe.

These LUTs will be auto-extracted just once.  After the initial extraction, the user is free to modify them however they want without worrying about being overwritten in the future.
  • Loading branch information
tannerhelland committed Jun 21, 2022
1 parent 9341f0e commit 6b769ea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
32 changes: 30 additions & 2 deletions Classes/pdResources.cls
Expand Up @@ -15,8 +15,8 @@ Attribute VB_Exposed = False
'PhotoDemon Resource Manager
'Copyright 2016-2022 by Tanner Helland
'Created: 13/December/16
'Last updated: 03/October/19
'Last update: switch to new pdPackage format for performance and memory gains
'Last updated: 21/June/22
'Last update: automatically extract 3D LUT (color lookup table) collection on first run
'
'PhotoDemon needs to include a whole swatch of custom resources. These resources take up a lot of space,
' and we also need to pull different resources depending on things like screen DPI. To simplify this process,
Expand Down Expand Up @@ -243,6 +243,34 @@ Friend Function ExtractDefaultAssets() As Boolean
UserPrefs.SetPref_Boolean "Assets", "ExtractedColorProfiles", True
End If

'3D LUTs
If (Not UserPrefs.GetPref_Boolean("Assets", "Extracted3DLUTs", False)) Then
PDDebug.LogAction "3D LUT collection has never been extracted before. Extracting now..."
If Me.LoadGenericResource("luts", tmpBytes) Then
If cPackage.OpenPackage_Memory(VarPtr(tmpBytes(0)), UBound(tmpBytes) + 1) Then
Do While cPackage.GetNextChunk(tmpChunkName, tmpChunkSize, tmpStream)
If (tmpChunkName = "NAME") Then
dstFilename = UserPrefs.GetLUTPath(True) & tmpStream.ReadString_UTF8(tmpChunkSize)
If cPackage.GetNextChunk(tmpChunkName, tmpChunkSize, tmpStream) Then
If (tmpChunkName = "DATA") Then
If (Not Files.FileCreateFromPtr(tmpStream.Peek_PointerOnly(0, tmpChunkSize), tmpChunkSize, dstFilename, True)) Then
RaiseResourceError "ExtractDefaultAssets: failed to create target file " & dstFilename
End If
End If
Else
RaiseResourceError "bad lut data: " & tmpChunkName
End If
Else
RaiseResourceError "bad lut name: " & tmpChunkName
End If
Loop
Else
RaiseResourceError "ExtractDefaultAssets: failed to extract profile resource chunk"
End If
End If
UserPrefs.SetPref_Boolean "Assets", "Extracted3DLUTs", True
End If

End Function

'Given a path to a .pdr file, attempt to load and validate it
Expand Down
2 changes: 1 addition & 1 deletion PhotoDemon.vbp
Expand Up @@ -513,7 +513,7 @@ Description="PhotoDemon Photo Editor"
CompatibleMode="0"
MajorVer=8
MinorVer=9
RevisionVer=1644
RevisionVer=1645
AutoIncrementVer=1
ServerSupportFiles=0
VersionComments="Copyright 2000-2022 Tanner Helland - photodemon.org"
Expand Down

0 comments on commit 6b769ea

Please sign in to comment.