SDWebImage / SDWebImage/SDWebImageWebPCoder
Skipping frames for Animated WebP
Nessuno ha ancora preso questa issue.
- Lingua principale
- Objective-C
- Stelle
- 277
- Fork
- 101
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
It would be good to have an option to skip frames for animated webP.
If I have a thumbnail trying to render an animated wepb image with 120 frames it could be good to render only 30 frames, to preserve speed and memory.
Maybe not the first 30 frames but skipping frames in a loop: the animation will not be very smooth obviously.
A simple, not nice looking solution to skip half of the frames:
SDImageWebPCoder.m
line 264
Adding a skipper in the loop and duplicating the duration
int skipper = 0;
do {
skipper++;
if ((skipper %2) == 0) {
continue;
}
@autoreleasepool {
CGImageRef imageRef = [self sd_drawnWebpImageWithCanvas:canvas iterator:iter colorSpace:colorSpace scaledSize:scaledSize];
if (!imageRef) {
continue;
}
#if SD_UIKIT || SD_WATCH
UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:UIImageOrientationUp];
#else
UIImage *image = [[UIImage alloc] initWithCGImage:imageRef scale:scale orientation:kCGImagePropertyOrientationUp];
#endif
CGImageRelease(imageRef);
NSTimeInterval duration = [self sd_frameDurationWithIterator:iter];
SDImageFrame *frame = [SDImageFrame frameWithImage:image duration:(duration*2)];
[frames addObject:frame];
}
} while (WebPDemuxNextFrame(&iter));
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia in SDImageWebPCoder.m, intorno alla riga 264, dove vengono decodificati i frame WebP animati e raccolte le durate. Determina come dovrebbe essere esposta e mantenuta sulle piattaforme Apple supportate un’opzione opt-in per saltare i frame, quindi verifica il numero di frame risultante e la temporizzazione dell’animazione con un fixture WebP animato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- objective-c
- Ambito
- mobile-dev
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100