-
Notifications
You must be signed in to change notification settings - Fork 55
Update fetch() for portrait oriented images #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to edit the given test code a bit to wait for a minute between retries. Sometimes it would succeed to send the image to adafruit io server, but fail to fully download it. The io server rate limit stopped the next several retries from succeeding.
The change looks good to me. With the 4.1.2 adafruit_pyportal.mpy file the portrait image from the sample code gets cropped in to the center of the original painting:
With the edited pyportal library, but without the new parameter the image looks the same, so there is no change for anyone that doesn't explicitly use the new parameter.
With the edited library and the new parameter included the image gets scaled to fit within the height of the pyportal screen:
I also tested the landscape image from the example code, the results were consistent between the 4.12 mpy library, the edited library with the new parameter, and the edited library without the new parameter.
I don't have much experience with pylint, so I am unsure about the effect of that change.
@cogliano Thanks for letting me know. I did a release so your update will be included in the version in the library bundle. It will go in when the bundle builds next, likely today. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_AM2320 to 1.1.4 from 1.1.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_AM2320#9 from Ferroin/master > Merge pull request adafruit/Adafruit_CircuitPython_AM2320#11 from adafruit/dherrada-patch-1 > Update README.rst > Merge pull request adafruit/Adafruit_CircuitPython_AM2320#10 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_DS1307 to 2.0.2 from 2.0.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_DS1307#15 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_DS1307#14 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_DS3231 to 2.2.2 from 2.2.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_DS3231#21 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch to 1.1.7 from 1.1.6: > update pylint examples directive Updating https://github.com/adafruit/Adafruit_CircuitPython_FRAM to 1.2.5 from 1.2.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_FRAM#14 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_FRAM#11 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C to 2.0.2 from 2.0.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_FXAS21002C#12 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_FXAS21002C#11 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700 to 2.0.2 from 2.0.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_FXOS8700#15 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_FXOS8700#14 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_HTU21D to 0.9.1 from 0.9.0: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_HTU21D#7 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_HTU21D#6 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_INA260 to 1.1.4 from 1.1.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_INA260#8 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_INA260#7 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3731 to 2.5.3 from 2.5.2: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3731#21 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3731#20 from makermelissa/master Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS0 to 2.1.3 from 2.1.2: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_LSM9DS0#16 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_LSM9DS0#15 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS1 to 2.0.6 from 2.0.5: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_LSM9DS1#18 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MatrixKeypad to 1.1.5 from 1.1.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MatrixKeypad#8 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MatrixKeypad#7 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MAX7219 to 1.2.3 from 1.2.2: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MAX7219#23 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP4725 to 1.2.1 from 1.2.0: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MCP4725#11 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MCP4725#10 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP9808 to 3.2.4 from 3.2.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MCP9808#20 from signalmeister/signalmeister-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MCP9808#22 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MCP9808#21 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90393 to 1.3.2 from 1.3.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#13 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#12 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MMA8451 to 1.2.5 from 1.2.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MMA8451#8 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MMA8451#7 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_MPL3115A2 to 1.1.6 from 1.1.5: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_MPL3115A2#10 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MPL3115A2#9 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_PCD8544 to 1.1.2 from 1.1.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_PCD8544#9 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_PCF8523 to 1.3.1 from 1.3.0: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_PCF8523#14 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_PCF8523#13 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_Pixie to 1.1.6 from 1.1.5: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_Pixie#14 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_Pixie#13 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_PyPortal to 3.1.6 from 3.1.5: > Merge pull request adafruit/Adafruit_CircuitPython_PyPortal#60 from cogliano/master Updating https://github.com/adafruit/Adafruit_CircuitPython_RA8875 to 3.0.1 from 3.0.0: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_RA8875#17 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_RFM69 to 1.3.1 from 1.3.0: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_RFM69#21 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_SD to 3.2.6 from 3.2.5: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_SD#30 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_SI4713 to 1.1.5 from 1.1.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_SI4713#11 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_SI4713#10 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_SI5351 to 1.1.5 from 1.1.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#10 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_SI5351#9 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_SI7021 to 3.1.5 from 3.1.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_SI7021#15 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_SI7021#14 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_TCA9548A to 0.2.2 from 0.2.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#14 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_TCA9548A#13 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_TCS34725 to 3.2.4 from 3.2.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_TCS34725#25 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_TLC5947 to 1.2.4 from 1.2.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_TLC5947#18 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_TLC5947#17 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_TMP007 to 2.0.1 from 2.0.0: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_TMP007#7 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_TMP007#6 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_TSL2561 to 3.2.3 from 3.2.2: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_TSL2561#28 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_TSL2561#27 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_VC0706 to 4.0.4 from 4.0.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_VC0706#11 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_VC0706#10 from kattni/update-example-pi > Merge pull request adafruit/Adafruit_CircuitPython_VC0706#9 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_VL53L0X to 3.1.7 from 3.1.6: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_VL53L0X#13 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_VL6180X to 1.1.5 from 1.1.4: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_VL6180X#10 from adafruit/dherrada-patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_VL6180X#9 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_OneWire to 1.1.4 from 1.1.3: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_OneWire#17 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_RTTTL to 2.3.2 from 2.3.1: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_RTTTL#18 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_Waveform to 1.2.6 from 1.2.5: > update pylint examples directive > Merge pull request adafruit/Adafruit_CircuitPython_Waveform#15 from adafruit/dherrada-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Added the following libraries: Adafruit_CircuitPython_BLE_Apple_Media, Adafruit_CircuitPython_NTP
This code was added to allow multiple fetch() commands to work correctly when there is a mix of portrait and landscape oriented images to display on the PyPortal. An additional parameter, image_dim_json_path, was added to init() to point to the JSON section that contains the original width and height of the image. If this parameter (a width and height tuple) is not present, the fetch should work as before with no portrait mode considerations.
Here is an example of the feature being used. I commented out some of the lines so the code could run without external file dependencies. Specific landscape and portrait itemids can be uncommented for testing, or use the randomint() function.
More info on the api used in the example is here: https://openaccess-api.clevelandart.org/