• Remix
  • Share
  • New Entry

on 17 Oct 2021
  • 18
  • 300
  • 0
  • 0
  • 264
%%%%% You wouldn't get this from any other computational engine!
%%
%% But really, how can I be committed *solely* to MATLAB???
%%% MATLAB has a great interface to Python, which ...
%%% opens up some interesting options
n=@(x)read(py.os.popen(x));
%nixd = @(cmd) disp(n(cmd)); % For displaying
n('wget https://c1.thejournal.ie/media/2018/10/gallery-1448452218-rick-astley-never-gonna-give-you-up-752x501.jpg -O b');
g=uint8(str2num(char(n('djpeg b | od -An -w1 -tu1 -v'))));
%m=752; % the resolution
%n=501;
for m=1:3
q(:,:,m)=reshape(g(15+m:3:end),752,501)';
end
imshow(q)
%% Explanation:
% Using python, we expose the system shell. HOWEVER, most of the useful
% python image packages are missing. We also do not have access to file access for
% the mini hack. (The "hack" part of this really is a joy!) So console
% linux to the rescue!
%
% Download any old image you want, convert the jpeg to a PPM file, output
% the PPM file as an array of integers, reshape into RGB arrays and
% display!
%
% I think this is my last idea, but maaaay be using this technique to meme
% a bit more next week. I'm pre-emptively sorry!
Image
Remix Tree
Load full remix tree