See my comment on the earlier commit. I don't think you should be comparing bytes and pixels one-to-one. And if that really is what you you want here, you need a big comment explaining why.  Otherwise this code looks badly mistaken.  But I guess this code predates this patch, so I'm willing to accept a fix in a followup.