Skip to content

Commit 4460389

Browse files
committed
Implements JPEG-XL coder using libjxl
1 parent b0955cf commit 4460389

File tree

13 files changed

+563
-98
lines changed

13 files changed

+563
-98
lines changed

.gitignore

+72-17
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
# macOS
2-
.DS_Store
3-
41
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## User settings
6+
xcuserdata/
7+
8+
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
9+
*.xcscmblueprint
10+
*.xccheckout
11+
12+
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
513
build/
14+
DerivedData/
15+
*.moved-aside
616
*.pbxuser
717
!default.pbxuser
818
*.mode1v3
@@ -11,26 +21,71 @@ build/
1121
!default.mode2v3
1222
*.perspectivev3
1323
!default.perspectivev3
14-
xcuserdata/
15-
*.xccheckout
16-
*.moved-aside
17-
DerivedData
24+
25+
## Obj-C/Swift specific
1826
*.hmap
27+
28+
## App packaging
1929
*.ipa
30+
*.dSYM.zip
31+
*.dSYM
2032

21-
# Bundler
22-
.bundle
33+
## Playgrounds
34+
timeline.xctimeline
35+
playground.xcworkspace
2336

24-
# Add this line if you want to avoid checking in source code from Carthage dependencies.
25-
# Carthage/Checkouts
37+
# Swift Package Manager
38+
#
39+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
40+
# Packages/
41+
# Package.pins
42+
# Package.resolved
43+
# *.xcodeproj
44+
#
45+
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
46+
# hence it is not needed unless you have added a package configuration file to your project
47+
# .swiftpm
2648

27-
Carthage/Build
49+
.build/
2850

51+
# CocoaPods
52+
#
2953
# We recommend against adding the Pods directory to your .gitignore. However
3054
# you should judge for yourself, the pros and cons are mentioned at:
31-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
32-
#
33-
# Note: if you ignore the Pods directory, make sure to uncomment
34-
# `pod install` in .travis.yml
55+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
56+
#
57+
Pods/
58+
Podfile.lock
59+
#
60+
# Add this line if you want to avoid checking in source code from the Xcode workspace
61+
# *.xcworkspace
62+
63+
# Carthage
3564
#
36-
# Pods/
65+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
66+
# Carthage/Checkouts
67+
68+
Carthage/Build/
69+
70+
# Accio dependency management
71+
Dependencies/
72+
.accio/
73+
74+
# fastlane
75+
#
76+
# It is recommended to not store the screenshots in the git repo.
77+
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
78+
# For more information about the recommended setup visit:
79+
# https://docs.fastlane.tools/best-practices/source-control/#source-control
80+
81+
fastlane/report.xml
82+
fastlane/Preview.html
83+
fastlane/screenshots/**/*.png
84+
fastlane/test_output
85+
86+
# Code Injection
87+
#
88+
# After new code Injection tools there's a generated folder /iOSInjectionProject
89+
# https://github.com/johnno1962/injectionforxcode
90+
91+
iOSInjectionProject/

Cartfile

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github "SDWebImage/SDWebImage" ~> 5.12
2+
github "SDWebImage/libjxl-Xcode"

Example/Podfile

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
use_frameworks!
1+
#use_frameworks! :linkage => :static
2+
install! "cocoapods",
3+
:generate_multiple_pod_projects => true
24

35
platform :ios, '10.0'
46

57
target 'SDWebImageJPEGXLCoder_Example' do
68
pod 'SDWebImageJPEGXLCoder', :path => '../'
7-
8-
target 'SDWebImageJPEGXLCoder_Tests' do
9-
inherit! :search_paths
10-
11-
12-
end
9+
pod 'libjxl', :path => '../../libjxl-Xcode'
10+
# pod 'libjxl', :git => '[email protected]:SDWebImage/libjxl-Xcode.git', :branch => 'master', :submodules => true
1311
end

Example/SDWebImageJPEGXLCoder.xcodeproj/project.pbxproj

+11-44
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
04A9457DE992494BEFACF05A /* Pods_SDWebImageJPEGXLCoder_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D31AA22FC08D1C3288C98DE9 /* Pods_SDWebImageJPEGXLCoder_Example.framework */; };
10+
1DB4F9190FE9AA3A80FDDC56 /* libPods-SDWebImageJPEGXLCoder_Example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B635E4BFBB27C9AE3AEF9975 /* libPods-SDWebImageJPEGXLCoder_Example.a */; };
1111
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58D195388D20070C39A /* Foundation.framework */; };
1212
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F58F195388D20070C39A /* CoreGraphics.framework */; };
1313
6003F592195388D20070C39A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6003F591195388D20070C39A /* UIKit.framework */; };
@@ -23,7 +23,6 @@
2323
6003F5BC195388D20070C39A /* Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6003F5BB195388D20070C39A /* Tests.m */; };
2424
71719F9F1E33DC2100824A3D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71719F9D1E33DC2100824A3D /* LaunchScreen.storyboard */; };
2525
873B8AEB1B1F5CCA007FD442 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 873B8AEA1B1F5CCA007FD442 /* Main.storyboard */; };
26-
B7C4D632F46E85FC1A07926F /* Pods_SDWebImageJPEGXLCoder_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11842E4314E6AF2209BDD90E /* Pods_SDWebImageJPEGXLCoder_Tests.framework */; };
2726
/* End PBXBuildFile section */
2827

2928
/* Begin PBXContainerItemProxy section */
@@ -37,10 +36,7 @@
3736
/* End PBXContainerItemProxy section */
3837

3938
/* Begin PBXFileReference section */
40-
11842E4314E6AF2209BDD90E /* Pods_SDWebImageJPEGXLCoder_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SDWebImageJPEGXLCoder_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
41-
1CE57ECF603D20DB94D6DA32 /* Pods-SDWebImageJPEGXLCoder_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageJPEGXLCoder_Tests.debug.xcconfig"; path = "Target Support Files/Pods-SDWebImageJPEGXLCoder_Tests/Pods-SDWebImageJPEGXLCoder_Tests.debug.xcconfig"; sourceTree = "<group>"; };
4239
4C9D51D01E2054B4D1665750 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; name = README.md; path = ../README.md; sourceTree = "<group>"; };
43-
5A5E4C2D7080E4CCEDBDF4C8 /* Pods-SDWebImageJPEGXLCoder_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageJPEGXLCoder_Tests.release.xcconfig"; path = "Target Support Files/Pods-SDWebImageJPEGXLCoder_Tests/Pods-SDWebImageJPEGXLCoder_Tests.release.xcconfig"; sourceTree = "<group>"; };
4440
6003F58A195388D20070C39A /* SDWebImageJPEGXLCoder_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SDWebImageJPEGXLCoder_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
4541
6003F58D195388D20070C39A /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4642
6003F58F195388D20070C39A /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
@@ -62,8 +58,8 @@
6258
606FC2411953D9B200FFA9A0 /* Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Tests-Prefix.pch"; sourceTree = "<group>"; };
6359
71719F9E1E33DC2100824A3D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
6460
873B8AEA1B1F5CCA007FD442 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
61+
B635E4BFBB27C9AE3AEF9975 /* libPods-SDWebImageJPEGXLCoder_Example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SDWebImageJPEGXLCoder_Example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6562
D1BD51CCD211DCDB3F86331F /* SDWebImageJPEGXLCoder.podspec */ = {isa = PBXFileReference; includeInIndex = 1; name = SDWebImageJPEGXLCoder.podspec; path = ../SDWebImageJPEGXLCoder.podspec; sourceTree = "<group>"; };
66-
D31AA22FC08D1C3288C98DE9 /* Pods_SDWebImageJPEGXLCoder_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SDWebImageJPEGXLCoder_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
6763
D657E12DD2C159259AFF2184 /* Pods-SDWebImageJPEGXLCoder_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageJPEGXLCoder_Example.release.xcconfig"; path = "Target Support Files/Pods-SDWebImageJPEGXLCoder_Example/Pods-SDWebImageJPEGXLCoder_Example.release.xcconfig"; sourceTree = "<group>"; };
6864
E1069EACF55330D46F087171 /* Pods-SDWebImageJPEGXLCoder_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SDWebImageJPEGXLCoder_Example.debug.xcconfig"; path = "Target Support Files/Pods-SDWebImageJPEGXLCoder_Example/Pods-SDWebImageJPEGXLCoder_Example.debug.xcconfig"; sourceTree = "<group>"; };
6965
E313B588E5C4965B6409AADA /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
@@ -77,7 +73,7 @@
7773
6003F590195388D20070C39A /* CoreGraphics.framework in Frameworks */,
7874
6003F592195388D20070C39A /* UIKit.framework in Frameworks */,
7975
6003F58E195388D20070C39A /* Foundation.framework in Frameworks */,
80-
04A9457DE992494BEFACF05A /* Pods_SDWebImageJPEGXLCoder_Example.framework in Frameworks */,
76+
1DB4F9190FE9AA3A80FDDC56 /* libPods-SDWebImageJPEGXLCoder_Example.a in Frameworks */,
8177
);
8278
runOnlyForDeploymentPostprocessing = 0;
8379
};
@@ -88,7 +84,6 @@
8884
6003F5B0195388D20070C39A /* XCTest.framework in Frameworks */,
8985
6003F5B2195388D20070C39A /* UIKit.framework in Frameworks */,
9086
6003F5B1195388D20070C39A /* Foundation.framework in Frameworks */,
91-
B7C4D632F46E85FC1A07926F /* Pods_SDWebImageJPEGXLCoder_Tests.framework in Frameworks */,
9287
);
9388
runOnlyForDeploymentPostprocessing = 0;
9489
};
@@ -123,8 +118,7 @@
123118
6003F58F195388D20070C39A /* CoreGraphics.framework */,
124119
6003F591195388D20070C39A /* UIKit.framework */,
125120
6003F5AF195388D20070C39A /* XCTest.framework */,
126-
D31AA22FC08D1C3288C98DE9 /* Pods_SDWebImageJPEGXLCoder_Example.framework */,
127-
11842E4314E6AF2209BDD90E /* Pods_SDWebImageJPEGXLCoder_Tests.framework */,
121+
B635E4BFBB27C9AE3AEF9975 /* libPods-SDWebImageJPEGXLCoder_Example.a */,
128122
);
129123
name = Frameworks;
130124
sourceTree = "<group>";
@@ -190,8 +184,6 @@
190184
children = (
191185
E1069EACF55330D46F087171 /* Pods-SDWebImageJPEGXLCoder_Example.debug.xcconfig */,
192186
D657E12DD2C159259AFF2184 /* Pods-SDWebImageJPEGXLCoder_Example.release.xcconfig */,
193-
1CE57ECF603D20DB94D6DA32 /* Pods-SDWebImageJPEGXLCoder_Tests.debug.xcconfig */,
194-
5A5E4C2D7080E4CCEDBDF4C8 /* Pods-SDWebImageJPEGXLCoder_Tests.release.xcconfig */,
195187
);
196188
name = Pods;
197189
path = Pods;
@@ -208,7 +200,7 @@
208200
6003F586195388D20070C39A /* Sources */,
209201
6003F587195388D20070C39A /* Frameworks */,
210202
6003F588195388D20070C39A /* Resources */,
211-
302503CEB7851320C00211DA /* [CP] Embed Pods Frameworks */,
203+
9C7C8C349281EFC35EE7F6B7 /* [CP] Copy Pods Resources */,
212204
);
213205
buildRules = (
214206
);
@@ -223,7 +215,6 @@
223215
isa = PBXNativeTarget;
224216
buildConfigurationList = 6003F5C2195388D20070C39A /* Build configuration list for PBXNativeTarget "SDWebImageJPEGXLCoder_Tests" */;
225217
buildPhases = (
226-
D4C258D4122B275A9F81BEB8 /* [CP] Check Pods Manifest.lock */,
227218
6003F5AA195388D20070C39A /* Sources */,
228219
6003F5AB195388D20070C39A /* Frameworks */,
229220
6003F5AC195388D20070C39A /* Resources */,
@@ -295,22 +286,22 @@
295286
/* End PBXResourcesBuildPhase section */
296287

297288
/* Begin PBXShellScriptBuildPhase section */
298-
302503CEB7851320C00211DA /* [CP] Embed Pods Frameworks */ = {
289+
9C7C8C349281EFC35EE7F6B7 /* [CP] Copy Pods Resources */ = {
299290
isa = PBXShellScriptBuildPhase;
300291
buildActionMask = 2147483647;
301292
files = (
302293
);
303294
inputPaths = (
304-
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageJPEGXLCoder_Example/Pods-SDWebImageJPEGXLCoder_Example-frameworks.sh",
305-
"${BUILT_PRODUCTS_DIR}/SDWebImageJPEGXLCoder/SDWebImageJPEGXLCoder.framework",
295+
"${PODS_ROOT}/Target Support Files/Pods-SDWebImageJPEGXLCoder_Example/Pods-SDWebImageJPEGXLCoder_Example-resources.sh",
296+
"${PODS_CONFIGURATION_BUILD_DIR}/SDWebImage/SDWebImage.bundle",
306297
);
307-
name = "[CP] Embed Pods Frameworks";
298+
name = "[CP] Copy Pods Resources";
308299
outputPaths = (
309-
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImageJPEGXLCoder.framework",
300+
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/SDWebImage.bundle",
310301
);
311302
runOnlyForDeploymentPostprocessing = 0;
312303
shellPath = /bin/sh;
313-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SDWebImageJPEGXLCoder_Example/Pods-SDWebImageJPEGXLCoder_Example-frameworks.sh\"\n";
304+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SDWebImageJPEGXLCoder_Example/Pods-SDWebImageJPEGXLCoder_Example-resources.sh\"\n";
314305
showEnvVarsInLog = 0;
315306
};
316307
A590F254C9CDB81C3AF6EBDD /* [CP] Check Pods Manifest.lock */ = {
@@ -335,28 +326,6 @@
335326
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
336327
showEnvVarsInLog = 0;
337328
};
338-
D4C258D4122B275A9F81BEB8 /* [CP] Check Pods Manifest.lock */ = {
339-
isa = PBXShellScriptBuildPhase;
340-
buildActionMask = 2147483647;
341-
files = (
342-
);
343-
inputFileListPaths = (
344-
);
345-
inputPaths = (
346-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
347-
"${PODS_ROOT}/Manifest.lock",
348-
);
349-
name = "[CP] Check Pods Manifest.lock";
350-
outputFileListPaths = (
351-
);
352-
outputPaths = (
353-
"$(DERIVED_FILE_DIR)/Pods-SDWebImageJPEGXLCoder_Tests-checkManifestLockResult.txt",
354-
);
355-
runOnlyForDeploymentPostprocessing = 0;
356-
shellPath = /bin/sh;
357-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
358-
showEnvVarsInLog = 0;
359-
};
360329
/* End PBXShellScriptBuildPhase section */
361330

362331
/* Begin PBXSourcesBuildPhase section */
@@ -523,7 +492,6 @@
523492
};
524493
6003F5C3195388D20070C39A /* Debug */ = {
525494
isa = XCBuildConfiguration;
526-
baseConfigurationReference = 1CE57ECF603D20DB94D6DA32 /* Pods-SDWebImageJPEGXLCoder_Tests.debug.xcconfig */;
527495
buildSettings = {
528496
BUNDLE_LOADER = "$(TEST_HOST)";
529497
FRAMEWORK_SEARCH_PATHS = (
@@ -548,7 +516,6 @@
548516
};
549517
6003F5C4195388D20070C39A /* Release */ = {
550518
isa = XCBuildConfiguration;
551-
baseConfigurationReference = 5A5E4C2D7080E4CCEDBDF4C8 /* Pods-SDWebImageJPEGXLCoder_Tests.release.xcconfig */;
552519
buildSettings = {
553520
BUNDLE_LOADER = "$(TEST_HOST)";
554521
FRAMEWORK_SEARCH_PATHS = (

Example/SDWebImageJPEGXLCoder.xcworkspace/contents.xcworkspacedata

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,72 @@
11
//
2-
// SDViewController.m
2+
// SDSDViewController.m
33
// SDWebImageJPEGXLCoder
44
//
55
// Created by dreampiggy on 02/26/2024.
66
// Copyright (c) 2024 dreampiggy. All rights reserved.
77
//
88

99
#import "SDViewController.h"
10+
#import <SDWebImageJPEGXLCoder/SDImageJPEGXLCoder.h>
11+
#import <SDWebImage/SDWebImage.h>
1012

1113
@interface SDViewController ()
14+
@property (nonatomic, strong) UIImageView *imageView1;
15+
@property (nonatomic, strong) SDAnimatedImageView *imageView2;
1216

1317
@end
1418

1519
@implementation SDViewController
1620

17-
- (void)viewDidLoad
18-
{
21+
- (void)viewDidLoad {
1922
[super viewDidLoad];
20-
// Do any additional setup after loading the view, typically from a nib.
23+
// Do any additional setup after loading the view, typically from a nib.
24+
25+
[SDImageCache.sharedImageCache clearDiskOnCompletion:nil];
26+
27+
[[SDImageCodersManager sharedManager] addCoder:[SDImageJPEGXLCoder sharedCoder]];
28+
29+
self.imageView1 = [UIImageView new];
30+
self.imageView1.contentMode = UIViewContentModeScaleAspectFit;
31+
[self.view addSubview:self.imageView1];
32+
33+
self.imageView2 = [SDAnimatedImageView new];
34+
self.imageView2.contentMode = UIViewContentModeScaleAspectFit;
35+
[self.view addSubview:self.imageView2];
36+
37+
NSURL *staticURL = [NSURL URLWithString:@"https://jpegxl.info/logo.jxl"];
38+
NSURL *animatedURL = [NSURL URLWithString:@"https://jpegxl.info/anim_jxl_logo.jxl"];
39+
40+
[self.imageView1 sd_setImageWithURL:staticURL placeholderImage:nil options:0 context:nil progress:nil completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
41+
if (image) {
42+
NSLog(@"%@", @"Static JPEG-XL load success");
43+
}
44+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
45+
NSUInteger maxFileSize = 4096;
46+
NSData *jxlData = [SDImageJPEGXLCoder.sharedCoder encodedDataWithImage:image format:SDImageFormatJPEGXL options:@{SDImageCoderEncodeMaxFileSize : @(maxFileSize)}];
47+
if (jxlData) {
48+
NSLog(@"%@", @"JPEG-XL encoding success");
49+
}
50+
});
51+
}];
52+
[self.imageView2 sd_setImageWithURL:animatedURL placeholderImage:nil options:SDWebImageProgressiveLoad completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
53+
if (image) {
54+
NSLog(@"%@", @"Animated JPEG-XL load success");
55+
}
56+
}];
2157
}
2258

23-
- (void)didReceiveMemoryWarning
24-
{
59+
- (void)viewWillLayoutSubviews {
60+
[super viewWillLayoutSubviews];
61+
self.imageView1.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height / 2);
62+
self.imageView2.frame = CGRectMake(0, self.view.bounds.size.height / 2, self.view.bounds.size.width, self.view.bounds.size.height / 2);
63+
}
64+
65+
- (void)didReceiveMemoryWarning {
2566
[super didReceiveMemoryWarning];
2667
// Dispose of any resources that can be recreated.
2768
}
2869

70+
2971
@end
72+

Example/Screenshot/JPEGXLDemo.png

256 KB
Loading

0 commit comments

Comments
 (0)