HTTP Error When Uploading Images with HTTPS?

Adding this to my theme’s functions.php solved this same problem for me:

add_filter( 'wp_image_editors', 'change_graphic_lib' );

function change_graphic_lib($array) {
    return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' );
}

error code: 523