Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-216

Image Decode Size Estimate

Problem

Estimate the decoded pixel height of an encoded image.

Given the encoded size in bytes, the decoded width and the bits per pixel, return round(file_bytes * 8 / (width * bits_per_pixel)) as an integer.

Test cases

case 1
in: [1200,100,8]
expected: 12
case 2
in: [900,30,8]
expected: 30
case 3
in: [100,10,8]
expected: 10
case 4
in: [2400,200,16]
expected: 6
Starter codePython
def estimate_height(file_bytes, width, bits_per_pixel):
    # Your code here
    pass

4 test cases · run your code against them in the editor