From 8fdccb68c0b16d5c2f8213f3697c76761af498ad Mon Sep 17 00:00:00 2001 From: Jonas Obrist Date: Tue, 13 Aug 2024 11:38:10 +0900 Subject: [PATCH] 3.0.1 --- .github/workflows/release.yml | 1 - .github/workflows/test.yml | 4 +++- .travis.yml | 9 --------- Cargo.lock | 2 +- Cargo.toml | 2 +- README.md | 7 +++++++ src/gif.rs | 15 ++++++++------- 7 files changed, 20 insertions(+), 20 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 520bd95..d1c5ded 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,6 @@ on: push: branches: - main - - master tags: - '*' pull_request: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6e309a9..6df2218 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,7 @@ name: Test -on: push +on: + push: + pull_request: jobs: test: runs-on: ubuntu-latest diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5caf6f1..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -sudo: false -language: python -python: - - "2.7" - - "3.4" - - "3.5" - - "nightly" - - "pypy" -script: python setup.py test diff --git a/Cargo.lock b/Cargo.lock index 343ddf5..07431fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,7 +28,7 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "imgsize" -version = "3.0.0" +version = "3.0.1" dependencies = [ "byteorder", "paste", diff --git a/Cargo.toml b/Cargo.toml index 4a9c0ef..8e3231d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "imgsize" -version = "3.0.0" +version = "3.0.1" edition = "2021" [lib] diff --git a/README.md b/README.md index 701620b..6698d55 100644 --- a/README.md +++ b/README.md @@ -80,3 +80,10 @@ The following must be run in a virtual env: pip install '.[test]' pytest python-tests ``` + +## Release + +1. Change the version number in `Cargo.toml` +2. Push to the main branch on GitHub (preferably via Pull Request) +3. Create a Release (git tag) on GitHub +4. Release will automatically be pushed to PyPI \ No newline at end of file diff --git a/src/gif.rs b/src/gif.rs index 4f4ee09..407853e 100644 --- a/src/gif.rs +++ b/src/gif.rs @@ -16,13 +16,14 @@ pub fn get_size(data: &[u8]) -> Option { let width = cursor.read_u16::()?; let height = cursor.read_u16::()?; let gtc_flag = cursor.read_u8()?; - let gce_offset = 0xd + if gtc_flag & (1 << 7) != 0 { - // Ref : https://www.w3.org/Graphics/GIF/spec-gif89a.txt - // 3 x 2^(Size of Global Color Table+1) - (1 << ((gtc_flag & 0x07) + 1)) * 3 - } else { - 0 - }; + let gce_offset = 0xd + + if gtc_flag & (1 << 7) != 0 { + // Ref : https://www.w3.org/Graphics/GIF/spec-gif89a.txt + // 3 x 2^(Size of Global Color Table+1) + (1 << ((gtc_flag & 0x07) + 1)) * 3 + } else { + 0 + }; cursor.seek(SeekFrom::Start(gce_offset))?; let animated = if cursor.read_u8()? == 0x21 { cursor.seek(SeekFrom::Start(gce_offset + 3))?;