If you would like to apply DCT to a JPEG (or any) image, you need to access its pixel data. To do this without struggling its inner structure, you can use some of the open source libraries on the net.
http://www.openjpeg.org[
^]
BTW, AFAIK, a JPEG image itself possibly has been DCTed already, that is, JPEG uses DCT for its lossy compression.